Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

inspect-codex-app-server

An Inspect solver and agent that run native Codex sessions inside Docker sandboxes via the Codex App Server JSON-RPC protocol.

Codex manages inference, tool execution, and subagent orchestration, while Inspect AI manages evaluation, scoring, tool governance, and token, message, and time limits.

Key Features

  • Use Your ChatGPT Subscription: Run evaluations directly against your ChatGPT subscription plan (or API key) using native Codex authentication.
  • Docker Sandbox Execution: Runs Codex as root with full access inside Docker sandboxes, including filesystem tools, bash commands, and subagents.
  • Inspect Agent: codex_agent() composes with as_solver(), as_tool(), handoff() and run(), with react-style submit, attempts, on_continue and retry_refusals.
  • Inspect Tool Bridging: Exposes Inspect tools (use_tools, MCP tool sources) directly to Codex as dynamic tools with validation, approval and review handling.
  • Inspect Approvals: Routes Codex's native command and file-change approval requests to the active Inspect approver.
  • Native Skills, Web Search and Roles: Installs Inspect skills as Codex skills, sets the native web search mode, and declares agent roles for Codex's child agents.
  • Operator Interruption and Checkpoints: Responds to operator interrupts and messages through Inspect's agent channel, and resumes from Inspect checkpoints.
  • Session & Quota Management: Handles rate limits, quota pauses (quota_hold_sec), transient turn-start retries with backoff, and token budgeting.
  • Transcript & Usage Tracking: Reconstructs model activity, tool events, and subagent spans into Inspect transcripts with live metrics.
  • Evidence & Artifact Capture: Retains protocol transcripts, session databases, and execution manifests for debugging and auditability.

Prerequisites & Installation

  • Python 3.11+
  • Docker (with Inspect Docker sandbox support)
  • Node.js and npm when a compatible pinned Codex bundle is unavailable.

For an npm-equipped container image, preinstall with RUN npm install -g --prefix /opt/codex @openai/codex@0.166.0 and add /opt/codex/bin to PATH. See provisioning constraints.

Install the package:

pip install -e .

Authentication

Run codex login on your host and provide its ~/.codex/auth.json, or select another file with CODEX_AUTH_PATH / auth_path.

Supported authentication modes:

  • "chatgpt": Uses ChatGPT subscription credentials.
  • "api_key": Uses an OpenAI API key.
  • "existing": Uses the container configuration and available credentials without enforcing an authentication mode.

Credentials are copied into /root/.cache/codex-inspect/auth.json inside the container. See configuration, credential storage, and logging details.

Quickstart

Define a task using codex_app_server:

from pathlib import Path
from inspect_ai import Task, task
from inspect_ai.dataset import Sample
from inspect_ai.scorer import match
from inspect_codex_app_server import codex_app_server

@task
def arithmetic():
    return Task(
        dataset=[Sample(input="What is 19 + 23? Reply with the number only.", target="42")],
        solver=codex_app_server(
            authentication="chatgpt",
            timeout_sec=600,
            max_child_agents=1,
        ),
        scorer=match(),
        sandbox=("docker", str(Path(__file__).with_name("compose.yaml"))),
    )

Run evaluation:

inspect eval examples/arithmetic.py --model codex/default

Inspect Agent

codex_agent() runs the same native session as an Inspect agent, so it composes like react():

from inspect_ai.agent import as_solver, as_tool
from inspect_codex_app_server import CodexSubagent, codex_agent

coder = codex_agent(
    name="coder",
    description="Solves programming tasks in the sandbox.",
    prompt="Work carefully and verify your answer.",
    submit=True,          # accept answers from the root submit tool
    attempts=3,           # score each submission; steer onward when incorrect
    subagents=[CodexSubagent(name="reviewer", description="Reviews changes.", token_limit=200_000)],
)

solver = as_solver(coder)   # or as_tool(coder), handoff(coder), run(coder, ...)

See the Inspect feature mapping and model settings and input formats for compatibility details.

Interruption and checkpoints

Operator interrupts stop native work and wait for follow-up input. Inspect checkpoints can resume the root thread; scoring-only resume starts no Codex process. See interruption and resume notes.

Solver Options

The codex_app_server solver accepts the following configuration parameters:

Parameter Type Default Description
authentication "existing" | "chatgpt" | "api_key" "existing" Required authentication mode.
timeout_sec float 600.0 Run budget including setup; teardown runs separately.
max_child_agents int 4 Maximum concurrent subagents per sample.
developer_instructions str | None None Thread developer instructions.
base_instructions str | None None Replacement for Codex's base instructions.
reasoning_effort str | None None Model reasoning effort (defaults to the evaluation's GenerateConfig).
reasoning_summary str | None None Reasoning summary detail (defaults to the evaluation's GenerateConfig).
retry_refusals int | None None Policy-blocked turns to continue before finishing with content_filter.
skills list[str | Path | Skill] | None None Inspect skills installed as Codex skills.
web_search "disabled" | "cached" | "indexed" | "live" | None None Native web search mode.
subagents list[CodexSubagent] | None None Native agent roles for Codex's child agents.
service_tier str | None None Service tier requested on root turns (e.g. "priority", "flex").
cwd str "/app" Working directory inside the container.
transport "stdio" | "websocket" "stdio" Transport protocol to communicate with the app server.
policy RunPolicy | None None Custom execution lifecycle and completion policy.
codex_path str | None None Host binary override (CODEX_PATH also works), taking precedence over image reuse.
auth_path str | None None Explicit path to the host auth.json.

Custom Lifecycle Policies (RunPolicy)

RunPolicy configures completion rules, quota waits, setup hooks, and timed steering reminders. See the lifecycle example and limits.

Development & Testing

The default suite includes real pinned Codex tests using local scripted model responses, without credentials or paid inference. Docker acceptance additionally requires a running Docker daemon and docker pull python:3.13-slim.

# Install development dependencies
uv sync --group dev

# Run the default suite, including native tests; excludes Docker acceptance
uv run pytest -q

# Run only tests that launch the real pinned Codex executable
uv run pytest -q -m native

# Run Docker acceptance separately
uv run pytest -q -m containers

# Run linter and type checker
uv run ruff check .
uv run ty check

# Validate generated JSON-RPC protocol schemas
uv run python scripts/generate_protocol.py --check

Automated compatibility releases

The test workflow checks pushes and pull requests, while the release workflow checks upstream releases hourly and publishes passing candidates to GitHub and PyPI. See release setup, publication, and retry notes.

License

MIT

Metadata

Release files for inspect-codex-app-server 2026.10.31

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for inspect-codex-app-server 2026.10.31
File Size Uploaded Provenance Actions
inspect_codex_app_server-2026.10.31.tar.gz 376.8 kB With provenance Details for inspect_codex_app_server-2026.10.31.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inspect-codex-app-server 2026.10.31
File Interpreter ABI Platform Actions
inspect_codex_app_server-2026.10.31-py3-none-any.whl Python 3 none any Details for inspect_codex_app_server-2026.10.31-py3-none-any.whl

Total release size: 467.4 kB

Release files / inspect_codex_app_server-2026.10.31.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL inspect_codex_app_server-2026.10.31.tar.gz
Size 376.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f1cac3b8d00816e89d273ca4c0a48d89b75b93827c00216dfdf3a481aca84d19
BLAKE2b-256 checksum
How to use checksums
a56c3e7fae1d81bbe50029aabe2f3630e522a0a796916113e29a47527dc85c0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / inspect_codex_app_server-2026.10.31-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL inspect_codex_app_server-2026.10.31-py3-none-any.whl
Size 90.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5eef2389b960e484d41a28051b8c05a53eb6793d38515166f1ae082181760a3
BLAKE2b-256 checksum
How to use checksums
c6c8140fdb7559caf9cc0bbb7b7bfbadc319adee6f76097375217b0d50e4c996
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for inspect-codex-app-server 2026.10.31

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Change of provenance

The configuration that created this release differs from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 2 files

Attestation for inspect_codex_app_server-2026.10.31.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page