Skip to content

Codex agents provide AgentPool's integration with the Codex app-server, enabling advanced code editing, terminal access, and tool execution through Codex's JSON-RPC protocol.

Overview

AgentPool integrates directly with Codex app-server via its JSON-RPC protocol, providing:

  • Native Codex features: Full access to Codex's reasoning, tools, and model capabilities
  • Low latency: Direct process communication via stdin/stdout
  • Toolset bridging: Expose AgentPool's internal toolsets to Codex via MCP
  • Streaming events: Real-time event propagation from Codex to AgentPool
  • Structured outputs: Support for typed response schemas via JSON Schema

Codex agents are ideal for:

  • Complex coding tasks with extended reasoning
  • Terminal operations and shell command execution
  • Multi-file refactoring and code generation
  • Tasks benefiting from Codex's reasoning effort levels

Configuration Reference

Codex Agent Configuration

Configuration for Codex app-server agent.

Wraps the Codex app-server via its JSON-RPC protocol, enabling integration with agentpool's agent ecosystem.

Codex Agent Configuration (YAML)
type: codex  # Top-level discriminator for agent type.
model: null  # Model to use for the Codex session.
reasoning_effort: null  # Reasoning effort level for the model.
approval_policy: never  # Tool call approval policy.
sandbox: workspace-write  # Sandbox mode for file operations.
personality: null  # Personality preset for the Codex session.
base_instructions: null  # Base system instructions for the Codex session.
developer_instructions: null  # Developer-provided instructions for the Codex session.
thread_options: {}  # Parameters of Codex's thread/start passed through (also on resume and fork, where
tools: []  # Tools and toolsets to expose to Codex via MCP bridge.
output_type: null  # Optional structured output type for responses. Can be either a reference to a response defined in ma...
requires_tool_confirmation: per_tool  # How to handle tool confirmation:
hooks:  # Hooks for intercepting and customizing agent behavior at key lifecycle points.
  pre_run: []  # Hooks executed before agent.run() processes a prompt.
  post_run: []  # Hooks executed after agent.run() completes.
  pre_tool_use: []  # Hooks executed before a tool is called. Can block or modify the call.
  post_tool_use: []  # Hooks executed after a tool completes.
environment: null  # Execution environment config for the agent's own toolsets.
name: null  # Identifier for the node. Set from dict key, not from YAML.
display_name: null  # Human-readable display name for the node.
description: null  # Optional description of the agent / team.
triggers: []  # Event sources that activate this agent / team
connections: []  # Targets to forward results to.
mcp_servers: []  # List of MCP server configurations:
input_provider: null  # Provider for human-input-handling.
event_handlers: []  # Event handlers for processing agent stream events.

Examples

Basic Configuration

A minimal Codex agent for coding tasks:

agents:
  codex_coder:
    type: codex
    environment: /path/to/project  # working directory (or an execution environment config)
    model: gpt-5.1-codex-max
    reasoning_effort: medium

Reasoning Effort

Control how deeply Codex reasons about tasks (the levels the model offers, for example low, medium, high):

agents:
  quick_helper:
    type: codex
    model: gpt-5.1-codex-max
    reasoning_effort: low  # Fast responses

  deep_thinker:
    type: codex
    model: gpt-5.1-codex-max
    reasoning_effort: high  # Complex problem solving

Approval Policy and Sandbox

approval_policy decides when Codex asks before running a tool: never (default for programmatic use), on-request (the model asks when it wants to) or untrusted (ask for everything not known to be safe). Approvals reach the user through AgentPool's input provider / the connected protocol client. sandbox limits file access (read-only, workspace-write, danger-full-access).

agents:
  auto_executor:
    type: codex
    approval_policy: never

  careful:
    type: codex
    approval_policy: untrusted
    sandbox: read-only

Toolset Integration

Expose AgentPool's tools and toolsets to Codex via an MCP bridge:

agents:
  codex_coordinator:
    type: codex
    environment: /path/to/project
    tools:
      - type: subagent  # delegate to the pool's other agents
      - type: search
        web_search: tavily
      - my_module.my_tool  # a function as a tool

Structured Output

Reference a response definition:

responses:
  bug_report:
    response_schema:
      type: inline
      fields:
        title:
          type: str
        severity:
          type: str
          description: "critical, high, medium or low"
        affected_files:
          type: list[str]

agents:
  bug_finder:
    type: codex
    output_type: bug_report

MCP Servers

agents:
  codex_with_fs:
    type: codex
    mcp_servers:
      - "uvx mcp-server-filesystem /path/to/workspace"  # stdio server shorthand
      - type: streamable-http
        url: http://localhost:8000/mcp

Passing Codex Options Through

thread_options passes parameters of Codex's thread/start request through unchanged (also on resume and fork), for options AgentPool does not model itself.

Runtime Switching

Model, reasoning effort and approval policy are config options of the agent: protocol clients (ACP, OpenCode) show them as switchable settings, and code can change them:

from agentpool import AgentPool

async with AgentPool("config.yml") as pool:
    agent = pool.get_agent("codex_coder")
    for model in await agent.get_available_models() or []:
        print(model.id)
    await agent.set_model("gpt-5.1-codex-mini")
    await agent.set_mode("high", category_id="reasoning_effort")

Comparison with Claude Code Agents

Feature Codex Agent Claude Code Agent
Protocol Codex JSON-RPC Claude Agent SDK
Reasoning control Reasoning effort levels Reasoning effort (adaptive thinking)
Tool approval Approval policies (never / on-request / untrusted) Permission modes
Models OpenAI (Codex) models Claude models

Choose Codex agents for:

  • Access to Codex-specific models and reasoning
  • Projects already using Codex
  • Tasks benefiting from Codex's reasoning effort system

Choose Claude Code agents for:

  • Pure Claude model access
  • Extended thinking capabilities
  • Tighter Claude ecosystem integration