Guides

Agent harnesses

Evaluate coding agents on real repository tasks in isolated sandboxes, score them with validators and judges, and build private task suites with agentclash agent-harness.

An agent harness is a workspace-scoped definition of a coding-agent task. It stores a task prompt, the runner and sandbox settings, an optional repository, and reusable evaluation config. You start executions of a harness, and each execution runs the coding agent in an isolated E2B sandbox, then scores the result.

Harnesses are not challenge packs. You do not author a pack, input set, or deployment to use one. Use a harness when you want to check a long-running autonomous coding agent (Codex, Claude, Hermes, or OpenClaw runner) against a concrete task. Use a challenge pack when you want to race models or deployments on a repeatable workload.

The command group is agentclash agent-harness, also available as agentclash harness.

Concepts

  • Harness: the task definition. Key fields are the task prompt, the runner kind, the auth secret, an optional repository URL and base branch, an execution_config and an evaluation_config.
  • Runner kind (--harness-kind): codex_e2b (default), claude_e2b, hermes_e2b, or openclaw_e2b. Each kind has a default E2B template. Override it with --codex-template.
  • Execution: one attempt at a harness. It moves through queued, provisioning, running, scoring, and then ends as completed, failed, or cancelled. The task prompt is snapshotted when the execution starts, so later edits to the harness do not change past executions.
  • Evaluation config: validators and LLM judges that score the result. A harness run is not complete when the agent exits; the configured validators run afterward, and a failing required validator fails the execution.
  • Suite: a private task bank. A suite holds tasks that you can run across several harnesses and rank.

Scoreable executions are linked to a canonical run, so replay, scorecards, and rankings reuse the same machinery as other runs. See Replay and scorecards. Harness runs do not appear in challenge-pack run lists.

Prerequisites

  • A selected workspace (agentclash workspace use <workspace-id>).
  • A workspace secret holding the runner provider API key. Create it first, as in Configure runtime resources:
bash
printf '%s' "$OPENAI_API_KEY" | agentclash secret set OPENAI_API_KEY
  • A sandbox provider configured for the workspace's worker. See Sandbox and E2B.

1. Create a harness

The hosted execution path uses api_key_secret auth, which is the default and only accepted --auth-mode. Point --api-key-secret at the workspace secret name.

bash
1agentclash agent-harness create \
2  --name "Fix flaky checkout test" \
3  --task "Find and fix the flaky checkout test. Do not change production code unrelated to the flake." \
4  --harness-kind codex_e2b \
5  --api-key-secret OPENAI_API_KEY \
6  --repository-url https://github.com/acme/shop \
7  --base-branch main \
8  --evaluation-config-file evaluation.json

--name and --task are required unless you use --from-file, which loads the whole spec from a JSON file. Use --execution-config for inline JSON execution settings; timeout_seconds in that object sets the execution timeout.

For the evaluation config, --evaluation-config-file takes a JSON file with validators and LLM judges, and --evaluation-config takes the same as inline JSON. See Evaluation spec and LLM judges for the building blocks.

Inspect what exists:

bash
1agentclash agent-harness list
2agentclash agent-harness get <harness-id>

2. Run it

bash
agentclash agent-harness run <harness-id> --follow

--follow polls until the execution reaches a terminal status; --poll-interval changes the polling interval (default 2s). --message overrides the task prompt for this one execution without changing the harness.

bash
1agentclash agent-harness run <harness-id> \
2  --message "Same task, but keep the fix under 20 changed lines." \
3  --follow

3. Inspect, cancel, retry

bash
1agentclash agent-harness executions <harness-id>       # all executions of one harness
2agentclash agent-harness execution get <execution-id>
3agentclash agent-harness execution cancel <execution-id>
4agentclash agent-harness execution retry <execution-id> --idempotency-key retry-1

execution retry only applies to a terminal execution. Pass --idempotency-key so a repeated call does not start a second retry.

4. Review failures

Failure review gives each failed execution a class and summary, so you can see patterns instead of reading every log.

bash
1# Aggregate view across the workspace
2agentclash agent-harness failures summary
3
4# Per-execution classification
5agentclash agent-harness execution failure-review get <execution-id>
6agentclash agent-harness execution failure-review update <execution-id> \
7  --human-class test_failure \
8  --human-summary "Agent fixed the symptom but not the shared fixture."

failure-review update also accepts suggested values (--suggested-class, --suggested-summary, --suggested-source rules|llm, --suggested-confidence) and JSON payloads (--human-payload, --suggested-payload, --from-file). At least one update flag is required.

Failure classes (--human-class, --suggested-class, and --failure-class on promote-task) must be one of setup, auth, tool_misuse, incomplete_implementation, no_op_diff, test_failure, overbroad_diff, no_pr, judge_failure, timeout, policy_privacy, infrastructure, none, or unknown. Any other value is rejected.

5. Build a private task suite

A suite is a private task bank you can run across several harnesses to compare runners or models on the same tasks.

bash
1agentclash agent-harness suite create \
2  --name "Checkout regressions" \
3  --task-json '{"title":"Fix flaky checkout","public_prompt":"Fix a flaky test.","task_prompt":"Find and fix the flaky checkout test.","source_type":"manual"}'

Each --task-json is one task object and may be repeated. Pass at least one --task-json, or pass --from-file instead. A task has a title, a public_prompt, a task_prompt, a source_type (manual, github_issue, upload, or prior_harness_run), and optional repository_url, base_branch, execution_config, evaluation_config, and metadata. If a task sets repository_url, every harness you run it on must have the same one.

Then run and rank:

bash
1agentclash agent-harness suite list
2agentclash agent-harness suite tasks <suite-id>
3agentclash agent-harness suite run <suite-id> --harness <harness-a>,<harness-b>
4agentclash agent-harness suite rankings <suite-id> --k 3

suite run requires at least one --harness; --task limits the run to specific task IDs. suite rankings reports pass@k and pass^k for the chosen --k (default 1), and --version-id pins an immutable suite version.

Suite runs store the task's public prompt and mark replay redaction on by default, so the private task text stays out of shared views.

6. Promote a real failure into the suite

When an execution exposes a good test case, promote it into a suite:

bash
1agentclash agent-harness execution promote-task <execution-id> \
2  --suite <suite-id> \
3  --title "Flaky checkout under retry" \
4  --public-prompt "Fix a flaky test in an order flow." \
5  --failure-class test_failure \
6  --failure-summary "Shared fixture leaked state between tests."

--suite and --title are required unless you use --from-file. Write a sanitized --public-prompt, since it is the part that stays visible outside the private task. --metadata takes inline JSON.

Info

Every command accepts --json, --output, and --query for scripting, plus --workspace to override the selected workspace. The full flag list is in the CLI reference.

See also