codex
Drive OpenAI's Codex CLI via its native app-server protocol — session resume, live step streaming, and per-action approval.
Installation
Requires the codex CLI and Codex auth:
Set $CODEX_CMD to override the binary path/command if needed.
Quick Start
Why app-server
ConnectOnion drives Codex's built-in app-server (OpenAI's native JSON-RPC 2.0 protocol) directly from Python — our own client is the adapter, so the only dependency is the codex binary itself, no external Node adapter.
This gets you session + resume (thread/start, thread/resume), live streaming of Codex's inner steps, and per-action approval — the server asks before each sensitive step, which maps onto agent.io.request_approval.
API
With no frontend to ask, manual approval denies each request rather than escalating.
Return Value
A JSON string envelope:
Resuming a Session
Approval Modes
| Mode | Behavior |
|---|---|
| manual | Default. Asks the human via agent.io, rendered as an approval card. With no frontend attached, requests are denied rather than escalated. |
| auto | Approves every request automatically — no human in the loop. |
Sandbox Levels
| Value | Meaning |
|---|---|
| read-only | Codex can inspect the codebase but not write to it |
| workspace-write | Default. Codex can edit files inside the working directory |
| danger-full-access | No sandbox restrictions — use with caution |
Frontend Contract
Codex's inner steps are streamed as the same events the connection layer bundled in @connectonion/react already maps to chat items — tool_call (stable tool ID) and tool_result — so no frontend or SDK change is needed to render Codex activity.
ConnectOnion