Ask Codex (OpenAI, ChatGPT subscription)
codex_askSend a prompt to Codex and receive its response, with optional sandboxed file editing and shell command execution. Use a thread ID to continue conversations or run parallel queries.
Instructions
Send a prompt to OpenAI Codex and get its response back. Codex can, if sandbox_mode is set to workspace-write, actually run shell commands and edit files under working_directory — not just answer in text. Pass the thread_id from a prior call to continue that conversation; omit it to start a fresh one. Independent calls (different or omitted thread_id) run concurrently as separate Codex conversations, so this can be used for many parallel queries as well as a single ongoing one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Override the Codex model (defaults to the CLI's configured default). | |
| prompt | Yes | The instruction or question to send to Codex. | |
| thread_id | No | Thread id returned by a previous codex_ask call. Pass it to continue that conversation with full prior context. Omit to start a new thread. | |
| timeout_ms | No | Abort the turn if it runs longer than this many milliseconds. | |
| web_search | No | Enable Codex's own live web search tool for this turn. | |
| sandbox_mode | No | read-only: Codex can inspect files and run non-mutating commands, but cannot write files or run arbitrary commands. workspace-write: Codex may edit files and run commands within working_directory (+ additional_directories). danger-full-access: no sandboxing at all. Default read-only. | read-only |
| output_schema | No | JSON Schema the final response must conform to (structured output). | |
| network_access | No | Only relevant when sandbox_mode is workspace-write: allow shell commands to reach the network. | |
| approval_policy | No | Codex's approval policy for actions outside the sandbox. Since this runs non-interactively there is no one to answer an approval prompt, so anything requiring escalation beyond sandbox_mode is simply denied regardless of this setting. Default never. | never |
| reasoning_effort | No | Override the model's reasoning effort. | |
| require_git_repo | No | If true, Codex refuses to run when working_directory is not inside a git repository, instead of skipping that check. | |
| working_directory | Yes | Absolute path Codex should treat as its working root (e.g. C:\path\to\repo). Required — there is no implicit default, to avoid Codex silently operating on the wrong directory. | |
| additional_directories | No | Extra absolute paths Codex may read/write beyond working_directory. |