# CodexAgent takes its permission policy as sandbox_mode

> Agno's `CodexAgent` reads its Codex permission policy, such as `"read-only"` or `"workspace-write"`, from `sandbox_mode`, the same name as Codex's own config key. A string passed as `sandbox=` still works and raises a `DeprecationWarning`.

- Published: 2026-10-16
- Author: Yash Pratap Solanky
- Categories: Changelog
- Canonical: https://www.agno.com/blog/codexagent-takes-its-permission-policy-as-sandbox-mode
- Markdown: https://www.agno.com/blog/codexagent-takes-its-permission-policy-as-sandbox-mode.md

Agno's `CodexAgent` hands `sandbox_mode` to Codex as its `sandbox` thread setting, which frees `sandbox=` for a provider such as `DockerSandbox`. Both can sit on one agent, a permission policy for Codex and a computer to run it in.

```python
from agno.agents.codex import CodexAgent

agent = CodexAgent(name="Codex", sandbox_mode="read-only")
```

Code that still passes the string keeps working. We built the agent both ways on both releases.

```text
# real output
Before:  CodexAgent(name="Codex", sandbox_mode="read-only")
         TypeError: CodexAgent.__init__() got an unexpected keyword argument 'sandbox_mode'
Now:     CodexAgent(name="Codex", sandbox="read-only")
         DeprecationWarning: CodexAgent(sandbox=<str>) is deprecated; use sandbox_mode. sandbox= now takes a Sandbox.
         sandbox_mode = 'read-only' | sandbox = None
```

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/frameworks/codex/codex_basic.py), and learn more about [running Codex](https://docs.agno.com/agent-os/multi-framework/codex) in the documentation.
