codex
v0.1.20OpenAI Codex as an iii worker; codex::run/start/stop/status/sessions::list spawn the codex CLI for headless turns, deliver raw thread events on the codex::raw-event trigger type and AgentEvent frames on codex::agent-event.
Install
iii trigger compose::add worker=codex@nextRun in your project with the iii engine running. Exact versions are immutable and digest-pinned.
skill doc
codex
The codex worker exposes the OpenAI Codex API as iii functions. One
codex::run call executes one headless Codex turn — the same agent the user
runs in their terminal, with the same login, filesystem, and sandbox — in a
chosen working directory, and returns the final result and token usage. The
worker is a pure pass-through: named payload fields cover the common path,
the options field forwards any Codex SDK ThreadOption verbatim, and every
thread event is delivered untouched on the codex::raw-event trigger type. A
translated AgentEvent view is delivered on codex::agent-event, which is what
the acp worker renders.
Requires the codex CLI on the host with an existing codex login or
OPENAI_API_KEY in the worker environment. When a turn needs a capability
beyond Codex itself, add another iii worker to the bus instead of bolting
anything onto this one.
When to Use
- Delegate a whole coding task ("add an endpoint and run the tests") in one
call, instead of orchestrating individual
coder::*/shell::*calls yourself:codex::runwithpromptandcwd. - Continue a conversation across calls: pass the same
session_idagain and the worker resumes the underlying Codex thread with full context. - Run long jobs without holding the call open:
codex::startreturns{session_id, started}immediately; bindcodex::raw-eventwith{ session_id }for raw progress orcodex::agent-eventfor the rendered view (or pollcodex::status); interrupt withcodex::stop. - Act on the whole backend: turns carry the iii runtime context by default
(delivered as Codex
developer_instructions), so the agent discovers and calls any registered function through the iii CLI (engine::functions::list,iii trigger); disable per turn with--help iii_context: false. - Plan before touching anything: run the planning prompt with
sandbox_mode: read-only(writes physically fail), read the plan, then send "implement the plan" on the samesession_idwithsandbox_mode: workspace-write. - Get structured final output: pass
output_schema(JSON schema) and the final agent message is JSON matching it. - Attach screenshots or diagrams:
images: ["/path/a.png"]adds local images to the prompt. - Wire MCP servers or model providers into one turn:
codex_configforwards anyconfig.tomloverride, e.g.{"codex_config": {"mcp_servers": {"github": {"command": "gh-mcp"}}}}. - Reach past the named payload fields: anything the SDK ThreadOptions
accept goes through
optionsunchanged, e.g.{"options": {"networkAccessEnabled": true, "webSearchMode": "live"}}.
Boundaries
- Spawns the host
codexCLI per turn — needs Codex installed and authenticated; not available inside a bare container without it. - Execution safety is Codex's own sandbox (
sandbox_mode), not the engine's:read-onlyblocks writes,workspace-writeallows edits incwd,danger-full-accessdisables the sandbox. Headless turns runapproval_policy: never, so blocked commands fail instead of prompting. - One turn per session at a time: check
codex::status(live: true) before sending anothercodex::runfor the samesession_id; parallel runs against one session race on the underlying thread resume. codex::agent-eventcarries whole-message frames; per-item progress detail (command output as it accumulates, todo lists) exists only oncodex::raw-event. Both feeds are ephemeral (not stored or replayed); order by(epoch, seq).
Functions
codex::run— run one Codex turn and wait; acceptsprompt(or amessagesarray whose last user entry becomes the prompt), plusmodel,cwd,sandbox_mode,approval_policy,reasoning_effort,skip_git_repo_check,output_schema, and rawoptions; returns{session_id, codex_thread_id, result, stop_reason, usage}.codex::start— same payload, returns{session_id, started}immediately; progress arrives on the event feeds.codex::stop— interrupt the live run for a session.codex::status— point-in-time session view: live flag, status, turns, usage.codex::sessions::list— every session this worker has run.