Docs > Integrations and CLI
CLI and SDK
# CLI and SDK The **`dex` CLI** (`@dex/cli`) and **`@dex/sdk`** TypeScript SDK talk to Dex's `/api/v1` REST API. Both workspace builders working locally and sandboxed agents running inside `claude` or `codex` harnesses use the exact same commands. Pass `--help` on any command for exact options, and `--json` for machine-readable output. ## Command reference by domain ### Factory (`dex factory`) Version, validate, publish, and share Factory definitions (defaults to `/workspace/factory` inside sandboxes): ```bash dex factory pull # Sync readable Factory tree from server dex factory tree # List readable Factory paths dex factory status # Inspect local edits dex factory diff # Review unstaged changes dex factory add <path> # Stage explicit paths (never add -A) dex factory commit -m "Update agent policy" # Commit locally dex factory preview # Validate schemas, ACLs, and ontology/view impact dex factory push # Publish commits and run server Apply dex factory access <path> # Inspect current grants on a workspace path dex factory share <path> <recipient> --role read # Grant read | write | none to email, Space, or workspace ``` There is no separate `dex skills` command—skills are authored, validated, and shared directly as Factory files via `dex factory`. ### Agents, runs, and cards (`dex agents`, `dex runs`) Manage shared agents, membership, coordinator runners, runs, and Pending Action feedback: ```bash dex agents list dex agents get <agent-id> dex agents create --title "Weekly brief" --schedule "0 9 * * 1" --timezone "UTC" --task "Summarize open items." dex agents share <agent-id> sam@acme.com --role read dex agents join <agent-id> dex agents on <agent-id> dex agents off <agent-id> dex agents leave <agent-id> dex agents coordinator <agent-id> --scope <scope-id> # Assign coordinator runner (--clear to remove) dex agents runs <agent-id> dex agents cards <agent-id> --feedback dex runs get <run-id> ``` ### Access Scopes (`dex scopes`) Inspect available integrations and manage per-user tool allowlists: ```bash dex scopes catalog # Canonical app names for AGENT.md `requires` dex scopes list dex scopes get <scope-id> dex scopes update <scope-id> ... ``` ### Ontology, Knowledge Graph, and SQL (`dex zeta`) Query Objects, Datasets, Observations, sharing settings, and read-only SQL views: ```bash dex zeta status dex zeta sources list dex zeta sources sharing set --account <account-id> --workspace dex zeta sources outputs bind ... dex zeta objects list dex zeta objects get --object person dex zeta objects create --data '{"name":"commitment","label":"Commitment","titleField":"title","fields":[...]}' dex zeta objects fields add --object commitment --data '{"field":{...}}' dex zeta operations get --id <operation-id> dex zeta records list --object person --filter '{"email":{"contains":"acme.com"}}' --limit 100 dex zeta records aggregate --object deal --group-by stage dex zeta records context --object person --id <record-id> dex zeta records create --object commitment --data '{"properties":{"title":"Send SOC 2"}}' --typecast dex zeta records update --object person --id <record-id> --data '{"properties":{...},"expectedVersion":"..."}' dex zeta records merge ... dex zeta observations list --object person --record-id <record-id> --search "renewal" dex zeta observations get --id <obs-id> --object person --record-id <record-id> --before 5 --after 5 dex zeta observations create --text "Note text" --object person:<record-id> dex zeta sharing set --target type:person dex zeta sql schema dex zeta sql query "SELECT COUNT(*) FROM o_person" ``` ### Views, Workflows, Issues, and Chats ```bash # Saved Views dex views list dex views get <view-id> dex views query <view-id> # Multi-member coordinator workflows dex workflows run <workflow-file.ts> # Self-improvement Agent Issues dex issues pull dex issues push # Chat transcripts and ATIF exports dex chats list dex chats messages <chat-id> dex chats transcript <chat-id> --format atif ``` ## Using `@dex/sdk` in coordinator workflows Coordinated [shared agents](/agents/shared-agents/#coordinator-mode-teammd-body) use `@dex/sdk/workflows` to invoke individual member runs from a workflow script executed via `dex workflows run`: ```ts title="workflows/team-renewal-rollup.ts" import { agent } from "@dex/sdk/workflows"; export async function run(members: Array<{ userId: string; email: string }>, agentId: string) { const results = await Promise.all( members.map(async (member) => { const result = await agent( "Check renewals closing within 60 days across your accounts and return open risks.", { agent: agentId, user: member.userId }, ); return { email: member.email, ...result }; }), ); return results; } ``` Each `agent(prompt, { agent, user })` call dispatches a normal child run executing **as that member** with their own OAuth accounts, Access Scope, personal working files, and Pending Action rules, and returns `{ runId, status, text }`. ## Related pages - [Factory definition as code](/factory/workspace-structure/) - `dex factory` workflow and conflict handling - [Shared agents](/agents/shared-agents/) - Coordinator workflows and `dex agents` lifecycle - [Ontology](/context/ontology/) - Authoring schemas and mappings with `dex zeta` - [Knowledge graph](/context/knowledge-graph/) - Querying records and Agent SQL - [Runs, dry runs, and self-improvement](/factory/measure-and-improve/) - Exporting transcripts and syncing Agent IssuesManage Factory files, personal and shared agents, Access Scopes, Zeta ontology and SQL queries, saved Views, and multi-member workflows with the dex CLI and @dex/sdk.
The dex CLI (@dex/cli) and @dex/sdk TypeScript SDK talk to Dex’s /api/v1 REST API. Both workspace builders working locally and sandboxed agents running inside claude or codex harnesses use the exact same commands.
Pass --help on any command for exact options, and --json for machine-readable output.
Command reference by domain
Section titled “Command reference by domain”Factory (dex factory)
Section titled “Factory (dex factory)”Version, validate, publish, and share Factory definitions (defaults to /workspace/factory inside sandboxes):
dex factory pull # Sync readable Factory tree from serverdex factory tree # List readable Factory pathsdex factory status # Inspect local editsdex factory diff # Review unstaged changesdex factory add <path> # Stage explicit paths (never add -A)dex factory commit -m "Update agent policy" # Commit locallydex factory preview # Validate schemas, ACLs, and ontology/view impactdex factory push # Publish commits and run server Applydex factory access <path> # Inspect current grants on a workspace pathdex factory share <path> <recipient> --role read # Grant read | write | none to email, Space, or workspaceThere is no separate dex skills command—skills are authored, validated, and shared directly as Factory files via dex factory.
Agents, runs, and cards (dex agents, dex runs)
Section titled “Agents, runs, and cards (dex agents, dex runs)”Manage shared agents, membership, coordinator runners, runs, and Pending Action feedback:
dex agents listdex agents get <agent-id>dex agents create --title "Weekly brief" --schedule "0 9 * * 1" --timezone "UTC" --task "Summarize open items."dex agents share <agent-id> sam@acme.com --role readdex agents join <agent-id>dex agents on <agent-id>dex agents off <agent-id>dex agents leave <agent-id>dex agents coordinator <agent-id> --scope <scope-id> # Assign coordinator runner (--clear to remove)dex agents runs <agent-id>dex agents cards <agent-id> --feedbackdex runs get <run-id>Access Scopes (dex scopes)
Section titled “Access Scopes (dex scopes)”Inspect available integrations and manage per-user tool allowlists:
dex scopes catalog # Canonical app names for AGENT.md `requires`dex scopes listdex scopes get <scope-id>dex scopes update <scope-id> ...Ontology, Knowledge Graph, and SQL (dex zeta)
Section titled “Ontology, Knowledge Graph, and SQL (dex zeta)”Query Objects, Datasets, Observations, sharing settings, and read-only SQL views:
dex zeta statusdex zeta sources listdex zeta sources sharing set --account <account-id> --workspacedex zeta sources outputs bind ...
dex zeta objects listdex zeta objects get --object persondex zeta objects create --data '{"name":"commitment","label":"Commitment","titleField":"title","fields":[...]}'dex zeta objects fields add --object commitment --data '{"field":{...}}'dex zeta operations get --id <operation-id>
dex zeta records list --object person --filter '{"email":{"contains":"acme.com"}}' --limit 100dex zeta records aggregate --object deal --group-by stagedex zeta records context --object person --id <record-id>dex zeta records create --object commitment --data '{"properties":{"title":"Send SOC 2"}}' --typecastdex zeta records update --object person --id <record-id> --data '{"properties":{...},"expectedVersion":"..."}'dex zeta records merge ...
dex zeta observations list --object person --record-id <record-id> --search "renewal"dex zeta observations get --id <obs-id> --object person --record-id <record-id> --before 5 --after 5dex zeta observations create --text "Note text" --object person:<record-id>dex zeta sharing set --target type:person
dex zeta sql schemadex zeta sql query "SELECT COUNT(*) FROM o_person"Views, Workflows, Issues, and Chats
Section titled “Views, Workflows, Issues, and Chats”# Saved Viewsdex views listdex views get <view-id>dex views query <view-id>
# Multi-member coordinator workflowsdex workflows run <workflow-file.ts>
# Self-improvement Agent Issuesdex issues pulldex issues push
# Chat transcripts and ATIF exportsdex chats listdex chats messages <chat-id>dex chats transcript <chat-id> --format atifUsing @dex/sdk in coordinator workflows
Section titled “Using @dex/sdk in coordinator workflows”Coordinated shared agents use @dex/sdk/workflows to invoke individual member runs from a workflow script executed via dex workflows run:
import { agent } from "@dex/sdk/workflows";
export async function run(members: Array<{ userId: string; email: string }>, agentId: string) { const results = await Promise.all( members.map(async (member) => { const result = await agent( "Check renewals closing within 60 days across your accounts and return open risks.", { agent: agentId, user: member.userId }, ); return { email: member.email, ...result }; }), );
return results;}Each agent(prompt, { agent, user }) call dispatches a normal child run executing as that member with their own OAuth accounts, Access Scope, personal working files, and Pending Action rules, and returns { runId, status, text }.
Related pages
Section titled “Related pages”- Factory definition as code -
dex factoryworkflow and conflict handling - Shared agents - Coordinator workflows and
dex agentslifecycle - Ontology - Authoring schemas and mappings with
dex zeta - Knowledge graph - Querying records and Agent SQL
- Runs, dry runs, and self-improvement - Exporting transcripts and syncing Agent Issues