Ask Codex (new session)
codex_askAsk OpenAI Codex a coding question or task in a new session and get the agent's final answer as text.
Instructions
Ask OpenAI Codex (codex exec) a question or task in a NEW session.
Uses your existing Codex login (ChatGPT or API key — see codex login status).
Returns the agent's final message as text, read from codex's
--output-last-message file (no stdout scraping). Codex is a capable coding
agent, so this suits heavier reasoning and real code work, not just cheap
tool-calling. Point workspace at a real project dir for context-aware answers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Optional model override (`-m`); omit to use codex's configured default. | |
| watch | No | If true, open a live "watch" view in your browser that streams codex's steps (reasoning, the commands it runs, file changes) from its `--json` event stream. codex still runs headless; the same final text is returned. Best-effort — if the browser can't open, the run completes normally. Default false. | |
| prompt | Yes | Question or instruction for Codex. | |
| sandbox | No | Filesystem policy — "read-only" (default: reads and answers but writes nothing), "workspace-write" (may edit files under the workspace), or "danger-full-access" (no sandbox — avoid). `codex exec` has no interactive approval gate, so this is the real safety boundary; opt into write access deliberately. WINDOWS CAVEAT (codex 0.149.1): sandboxed runs there currently refuse EVERY command, both policies, down to `pwd` — codex's policy engine cannot classify the `pwsh -Command <...>` wrapper it builds. Shell commands are how codex reads files, so it sees none of the workspace and ANSWERS ANYWAY, from its own knowledge or a web search, with no hint that it read nothing. The bridge appends a visible "[agent-intern] WARNING" to any answer whose run had commands refused: if you see it, treat the answer as unsourced. | read-only |
| timeout_s | No | Max seconds to wait for codex to complete. Default 180. | |
| workspace | No | Working root for the session (`-C`). Defaults to the server cwd. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |