Skip to main content
The codex harness runs the OpenAI Codex CLI non-interactively in a benchmark-prepared workspace.

How it works

  • Prepare Codex CLI. If codex is absent from the image, the harness applies install_strategy and install_command.
  • Configure and run. The harness writes a session-scoped Codex provider configuration and invokes the CLI non-interactively in the task workspace. Recipes may place this configuration outside the repository so it cannot enter a generated patch.
  • Collect results. Codex JSON events are normalized into the trajectory, final answer, and execution status in a RunResult.

Parameters

Pass harness options with --harness-params '{...}'. The table exposes the installation, provider, and execution behavior that normally needs tuning; path and upload details use built-in defaults.

Parameter reference

ParameterTypeDefaultChoices / valuesDescription
install_strategystringinstall_if_missingpreinstalled / install_if_missing / uploadHow to prepare Codex.
install_commandstringnpm install -g @openai/codexshell commandCommand used when Codex is missing.
sandboxstringworkspace-writeread-only / workspace-write / danger-full-accessCodex sandbox policy.
reasoning_effortstringunsetprovider-supported effortValue written to Codex as model_reasoning_effort.
timeoutint / nullunsetinteger ≥ 1 or nullWall-clock timeout for the complete Codex task.
dangerously_bypass_approvals_and_sandboxbooltruetrue / falseWhether to pass —dangerously-bypass-approvals-and-sandbox. Set it to false only when the Codex approval and sandbox flow must be retained.

Model API

Codex requires an OpenAI-compatible --model-base-url and --model-api-key. --model-api-protocol openai-responses selects the Responses API and openai-chat selects Chat Completions; the CLI protocol takes precedence over the harness’s internal wire_api fallback. The harness appends /v1 when it is absent from the base URL.

Run examples

Run with the default installation and workspace-write policy.

Output

The harness returns a RunResult per task: trajectory, final answer, and execution status. Per-task details and aggregate metrics are written by the benchmark under results/<benchmark>/<model>/<run>/ (see Results).