Codex CLI: Code-Focused AI Backend
The Codex CLI backend wraps OpenAI’s Codex CLI as a subprocess, providing code-focused agent capabilities with MCP support.
Overview
- Status: Beta
- Provider support: OpenAI
- Built-in tools: shell, file_edit, web_search, mcp
- MCP support: Yes
- Architecture: Subprocess wrapper — spawns the
codexbinary
Prerequisites
Install the Codex CLI globally:
npm install -g @openai/codexVerify it’s on your PATH:
codex --versionConfiguration
export POCKETPAW_AGENT_BACKEND="codex_cli"export POCKETPAW_OPENAI_API_KEY="sk-..."The backend also accepts CODEX_API_KEY as an alternative to OPENAI_API_KEY.
Backend-Specific Settings
| Setting | Env Variable | Default | Description |
|---|---|---|---|
codex_cli_model | POCKETPAW_CODEX_CLI_MODEL | "gpt-5.3-codex" | Model to use |
codex_cli_max_turns | POCKETPAW_CODEX_CLI_MAX_TURNS | 0 (unlimited) | Max tool-use turns per query |
Built-in Tools
| Codex Tool | Policy Mapping |
|---|---|
shell | shell |
file_edit | write_file |
web_search | browser |
mcp | mcp |
How It Works
- PocketPaw spawns the
codexCLI binary as a subprocess - Messages and history are injected via the CLI’s input interface
- Output streams as NDJSON (newline-delimited JSON)
- PocketPaw parses NDJSON events into
AgentEventobjects - MCP servers are forwarded to the Codex CLI
When to Use
Choose Codex CLI when:
- You want a code-focused agent optimized for programming tasks
- You’re already using OpenAI’s Codex CLI and want it integrated into PocketPaw
- You need MCP support with an OpenAI-based backend
Related
OpenAI Agents SDK
Another OpenAI-powered backend with GPT models and Ollama support.
Claude Agent SDK
The recommended backend with native tools and MCP integration.
All Agent Backends
Compare all six backends side by side with capability badges.
Was this page helpful?