Skip to main content
The claude_code harness runs Claude Code non-interactively in a benchmark-prepared workspace.

How it works

  • Prepare Claude Code CLI. If claude is absent from the image, the harness applies install_strategy and install_command.
  • Configure and run. The harness writes a session-scoped Anthropic-compatible model configuration and invokes Claude Code headlessly. Recipes may pass an external settings file so credentials cannot enter a generated repository patch.
  • Collect results. Claude Code JSON records 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 and agent 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 Claude Code.
install_commandstringnpm install -g @anthropic-ai/claude-codeshell commandCommand used when Claude Code is missing.
max_turnsint400integer ≥ 1Maximum agent turns for one task.
max_output_tokensint / nullunsetinteger ≥ 1 or nullMaximum output tokens for one response. When unset, Claude Code uses its default.
append_system_promptstringunsetany stringAdditional system prompt appended for Claude Code.
timeoutint / nullunsetinteger ≥ 1 or nullWall-clock timeout for the complete Claude Code task.
dangerously_skip_permissionsbooltruetrue / falseWhether to pass —dangerously-skip-permissions. Set it to false only when Claude Code permission prompts must be retained.

Model API

Claude Code requires an Anthropic-compatible --model-base-url and --model-api-key, with --model-api-protocol anthropic. When the base URL ends in /v1, the harness removes that suffix before writing the Claude Code configuration.

Run examples

Run with the default installation and agent behavior.

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).