codex
Runs a terminal coding agent that reads and edits files to implement, refactor, or fix code, then returns the output.
Instructions
OpenAI Codex — a terminal coding agent (GPT/o-series) that autonomously reads and edits files to implement, refactor, and fix code. Runs the codex CLI non-interactively in cwd — it can read and edit files there and may take time or use the agent's own model quota — and returns its output. On common failures returns a classified, actionable error (not installed / not authenticated with the exact login command / not configured / timed out / busy / output-limit); other non-zero exits return a clipped stderr/stdout tail. Check availability with list_agents first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory for the CLI. Prefer an absolute path; a relative path resolves from the server process's cwd. Not a sandbox — the agent may read/edit any files it can access. | |
| model | No | Optional model id passed through to the CLI, overriding that CLI's configured/default model (e.g. "o3"). Model names are agent-specific. Must match [A-Za-z0-9][A-Za-z0-9._:/-]{0,127} — a flag-shaped value is rejected. | |
| prompt | Yes | The task or question for the agent, in natural language. | |
| timeoutMs | No | Total runtime cap in milliseconds — the hard upper bound on the whole run once the CLI starts (excludes time queued behind the concurrency limit); the process group is killed if exceeded (default 1800000 = 30 minutes). | |
| idleTimeoutMs | No | Idle/inactivity timeout in milliseconds — the run is killed only if the agent produces NO output for this long (the timer resets on each output chunk; default 300000 = 5 minutes). |