Tools and Approvals
When a model asks to use a tool, the Codex runtime interprets the request and decides whether and how to execute it. For shell execution, two settings are useful to keep separate. The sandbox defines where and how a command may run. The approval policy governs when the runtime can ask a reviewer to approve an action. Agent approvals and security · Source walkthrough
Choose a mode for the task
Section titled “Choose a mode for the task”| Task | Example CLI mode | What to expect |
|---|---|---|
| Inspect a file or explain a code path | codex --sandbox read-only --ask-for-approval on-request |
Commands can inspect files within the active read-only policy. An action outside that policy can require approval. |
| Edit a repo and run its tests | codex --sandbox workspace-write --ask-for-approval on-request |
Edits can use the configured writable roots. Protected paths and operations outside the policy can still require approval. |
These commands illustrate interactive CLI settings. The effective permissions can depend on configuration and administrator policy. In an interactive session, read Directory and Permissions in /status, then use /permissions to inspect the available choices. Use /debug-config to see which configuration layers and managed requirements apply. Status example · Config display Sandbox and approval combinations
Check the effective scope
Section titled “Check the effective scope”Open Codex in the scratch repo using the read-only command above. Compare the active working directory and writable roots in /status with the task. Then open /permissions to see the current options. Decide before you submit whether the task requires reading a file only or writing a specific artifact. Inspect settings
| Observation | What to examine |
|---|---|
| A command completes | Inspect executed arguments, exit status, and the expected artifact. |
| A write needs approval | Read the target path and the requested operation before deciding. |
| The command returns an error | Check its output and whether the shell actually started. Argument validation, execution, and authorization fail at different stages. |
Read an approval request
Section titled “Read an approval request”- Identify the operation, working directory, and affected files or services.
- Compare its effect with the task. For a CSV inspection, reading the file fits the request. Writing a report to disk changes the scope.
- Decide based on the requested action and its side effects. If a different action is needed, describe it in the prompt and check the new request.
A completion message from the agent is a report of what it observed. For an edit or a command, also inspect the changed files or recorded result when you need evidence of the effect. The tool-call walkthrough shows how an upstream test checks that command output reaches the next model request. For a declined command, compare the completed command status with the reason passed back to the model. Trace an approval decision