claude_code harness runs Claude Code non-interactively in a benchmark-prepared workspace.
How it works
- Prepare Claude Code CLI. If
claudeis absent from the image, the harness appliesinstall_strategyandinstall_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
| Parameter | Type | Default | Choices / values | Description |
|---|---|---|---|---|
install_strategy | string | install_if_missing | preinstalled / install_if_missing / upload | How to prepare Claude Code. |
install_command | string | npm install -g @anthropic-ai/claude-code | shell command | Command used when Claude Code is missing. |
max_turns | int | 400 | integer ≥ 1 | Maximum agent turns for one task. |
max_output_tokens | int / null | unset | integer ≥ 1 or null | Maximum output tokens for one response. When unset, Claude Code uses its default. |
append_system_prompt | string | unset | any string | Additional system prompt appended for Claude Code. |
timeout | int / null | unset | integer ≥ 1 or null | Wall-clock timeout for the complete Claude Code task. |
dangerously_skip_permissions | bool | true | true / false | Whether 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
- Default
- Custom params
Run with the default installation and agent behavior.
Output
The harness returns aRunResult 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).