Dex Agents CLI
View as MarkdownThe Dex Agents CLI runs an agent in your terminal as a durable Dex session. You chat with the agent, approve its tool calls, and continue the same session after you stop the command. You write no application code.
The recording asks about an order, approves a write to notes.md, exits, and resumes the session. After the resume, the agent still knows what it wrote.
Install
Each command runs one agent SDK or the Dex Agent Framework, such as dex-agents-openai-sdk for the OpenAI Agents SDK and dex-agents-builtin for the Dex Agent Framework. CLI commands lists them all. Python commands need Python 3.11 or later; TypeScript commands need Node.js 22, 24, or 26; dex-agents-pi needs 22.19 or later on the 22 line.
Run a command without installing it:
uvx --from dex-agents-openai-sdk-cli dex-agents-openai-sdk
npx -p @superdurable/dex-agents-openai-sdk-cli dex-agents-openai-sdk
Or install it to keep it on your PATH:
pip install dex-agents-openai-sdk-cli
npm install -g @superdurable/dex-agents-openai-sdk-cli
The command needs two things:
- A model API key in its standard environment variable, such as
OPENAI_API_KEY. The command never stores or prints it. Provider keys names the variable for each command. - A Dex Server. By default the command reuses a running
dexcli devon this machine, or starts one. To use a shared server or Dex Cloud, setdex.serverin the configuration file; see Run against a remote Dex server.
Run a session
Start the command:
dex-agents-openai-sdk
On the first run, it asks a few questions, such as the model and the workspace folder, and writes ~/.dex/agents/openai-sdk.yaml. It then opens a chat and prints the session ID.
Type a message and press Enter. Each tool call shows as a line. A call that needs approval, such as a file write, opens a panel with its arguments: press y to approve, n to reject, or r to reject with a reason. The session waits in Dex until you answer.
Press Ctrl-C twice to exit. The session stays in Dex, and the command prints the line that continues it:
dex-agents-openai-sdk --resume SESSION_ID
The resumed session keeps its messages and tool results. dex-agents-openai-sdk sessions lists your sessions.
See it in Dex Web
This recording follows the same session in Dex Web; Show sessions in Dex Web explains what it shows.
Open Dex Web at http://127.0.0.1:8802 for the local dexcli dev, or use the Dex Web link that the command prints. The session's Conversation tab shows each message, tool call, and approval. To send messages and answer approvals there, choose the permission dex-agents-cli.operate in Working as. These actions work while a command has the session open. Sessions in Dex Web has the details.
Next
- Connectors as Tools: give your agent official Connector operations as tools.
- Use Dex with Agent SDKs: make your own agent durable.
- Dex Agent Framework: build a durable agent without another agent SDK.
- Dex Agents CLI reference: commands, configuration, the chat, tools, approval modes, and payload encryption.