Execute a task with Codex
codex_executeInitialize a session to run a task or plan in a workspace, providing a session ID, agent messages, file modifications, and executed commands.
Instructions
Start a new Codex session that executes a plan/task in the given workspace. Returns sessionId (keep it to send review feedback later), agent message, file changes and commands run.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | Yes | Absolute path of the workspace Codex should work in | |
| model | No | Codex model override, e.g. gpt-5.1-codex | |
| prompt | Yes | Task or plan for Codex to execute (can embed full plan text) | |
| sandbox | No | Codex sandbox policy (default: workspace-write) | workspace-write |
| terminal | No | Open a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1) | |
| timeoutMs | No | Max execution time in ms (default: 30 minutes) |