Skip to content
Esc
↑↓navigate↵open⌘Jpreview
Start
On this page

Evaluating Coding Agents

Build evaluation systems to measure how well coding agents perform on real-world tasks. Create structured test suites from Level 100 (easy) to Level 400 (expert), benchmark against Terminal Bench, and generate actionable reports.

Why evaluations matter

Coding agents claim impressive capabilities, but claims without measurement are marketing. Rigorous evaluations answer concrete questions: Can this agent refactor a module without breaking tests? Does it handle edge cases in database migrations? How does it perform compared to last week’s version?

A well-designed evaluation system provides:

  • Objective comparison: Benchmark Autohand against other coding tools using standardized tasks
  • Regression detection: Catch capability degradation before it reaches production
  • Skill gap identification: Discover which task categories need improvement
  • Confidence calibration: Know when to trust agent output versus when to verify manually

Difficulty levels

Evaluations are organized into four difficulty tiers, following a progression from fundamental skills to expert-level challenges.

Level 100: Foundational

Basic tasks that any competent coding agent should handle reliably. Failure at this level indicates fundamental problems.

  • Single-file edits with clear instructions
  • Simple bug fixes with obvious solutions
  • Adding basic functions or methods
  • Formatting and linting fixes
  • Writing simple unit tests
# Level 100 task outline (task.json format below)
name: fix-syntax-error
level: 100
description: Fix the syntax error in the JavaScript file
setup: |
  Create a file with a missing closing bracket
verification: |
  File parses without errors
  Original logic preserved

Level 200: Intermediate

Tasks requiring understanding of code context and multi-step reasoning.

  • Multi-file refactoring
  • Implementing features from specifications
  • Debugging with stack traces
  • Writing integration tests
  • API endpoint implementation
# Level 200 task outline (task.json format below)
name: implement-pagination
level: 200
description: Add pagination to the /api/users endpoint
setup: |
  Existing Express app with user listing
  Database has 1000+ test records
verification: |
  Accepts page and limit query params
  Returns correct subset of results
  Includes total count in response

Level 300: Advanced

Complex tasks requiring architectural decisions and cross-cutting concerns.

  • Performance optimization with profiling
  • Security vulnerability remediation
  • Database schema migrations
  • Implementing caching strategies
  • Cross-service integration
# Level 300 task outline (task.json format below)
name: optimize-n-plus-one
level: 300
description: Identify and fix N+1 query problem in order listing
setup: |
  Django app with Order, LineItem, Product models
  Test database with 100 orders, 500 line items
verification: |
  Query count reduced from 501 to under 10
  Response time improved by at least 80%
  All existing tests pass

Level 400: Expert

Challenges that require deep expertise and sophisticated reasoning.

  • Concurrent system debugging
  • Compiler or interpreter modifications
  • Cryptographic implementation review
  • Distributed system consistency fixes
  • Low-level performance optimization
# Level 400 task outline (task.json format below)
name: fix-race-condition
level: 400
description: Fix race condition in distributed lock implementation
setup: |
  Redis-based distributed lock with subtle timing bug
  Concurrent test harness that triggers the race
verification: |
  100,000 concurrent lock attempts with zero conflicts
  No deadlocks under high contention
  Maintains lock semantics under network partitions

Task categories

Organize evaluations by the type of coding work to identify specific strengths and weaknesses.

Category Description Example tasks
Bug Fixing Identifying and resolving defects Null pointer fix, off-by-one errors, logic bugs
Feature Implementation Building new functionality API endpoints, UI components, data models
Refactoring Improving code structure Extract method, rename symbol, reorganize modules
Testing Writing and improving tests Unit tests, integration tests, test coverage
Performance Optimizing speed and resources Query optimization, memory leaks, caching
Security Finding and fixing vulnerabilities SQL injection, XSS, authentication flaws
DevOps Infrastructure and deployment CI pipelines, Docker configs, monitoring
Documentation Technical writing API docs, README updates, code comments

Creating an evaluation suite

Autohand Code CLI has no built-in eval command. An evaluation suite is a folder of task files plus a small runner script. The runner copies each task into a fresh directory, runs autohand in headless mode, then runs the task’s own checks to decide pass or fail.

Directory structure

evals/
  tasks/
    level-100/
      fix-syntax-error/
        task.json       # Task definition
        setup/          # Initial state files, copied into a fresh directory
      add-function/
        ...
    level-200/
      implement-pagination/
        ...
    level-300/
      ...
    level-400/
      ...
  scripts/
    run-eval.py         # Runner (below)
    compare-reports.py  # Compares two reports (below)

Task definition format

Each task is a JSON file with the prompt, a time limit, optional setup commands, and the checks that decide whether it passed. The runner below reads these fields; add your own as needed.

{
  "name": "implement-jwt-auth",
  "level": 200,
  "category": "feature-implementation",
  "timeout": 300,
  "setup_commands": ["npm install"],
  "prompt": "Add JWT authentication to this Express app: create POST /auth/login, return a JWT on successful login, protect /api/* routes with middleware, and read the secret from JWT_SECRET.",
  "verification": {
    "tests": ["npm test"],
    "assertions": [
      {"file_exists": "src/middleware/auth.js"},
      {"file_contains": ["src/middleware/auth.js", "JWT_SECRET"]}
    ]
  }
}

Put the behaviour you care about (endpoints returning 200 or 401, for example) in the test command, so the check is code you control rather than the agent’s own report.

Running one task by hand

Each task run is one headless command. These flags make it suitable for scoring:

cp -R evals/tasks/level-200/implement-auth/setup /tmp/eval-auth
autohand --bare --ephemeral --path /tmp/eval-auth \
  -p "$(jq -r .prompt evals/tasks/level-200/implement-auth/task.json)" \
  --yes --json local --max-duration 300 > result.json
echo "exit: $?"
(cd /tmp/eval-auth && npm test)
Flag Why it helps an eval
-p Runs one instruction and exits: status 0 when the run completes, 1 when it fails or a budget is hit.
--bare Skips hooks, LSP, plugin sync, auto-memory and AGENTS.md auto-discovery, so local setup does not leak into results.
--ephemeral Keeps the run out of session history and auto-memory, so one task cannot influence the next.
--path Sets the workspace to the task’s fresh directory.
--yes Auto-confirms risky actions so the run does not wait for a prompt. Run evals in a container or throwaway directory.
--json local Prints one JSON object at the end: {"type":"result","content":...} or {"type":"error","message":...}. Progress goes to stderr.
--output-format stream-json Prints one JSON event per line instead (tool_start, tool_end, file_modified, result, error), useful for counting tool calls or files touched.
--max-duration, --max-requests, --max-tokens Stop a run that goes on too long; the run fails with exit status 1.
--model Runs the same suite against different models.
--output-schema <file> Requires the final answer to be one JSON document valid against a JSON Schema. If the answer does not match, the CLI asks the model once to repair it, then fails the run.

Use --output-schema for tasks graded on an answer rather than on code, such as “find the bug and name the file and line”:

cat > answer.schema.json <<'JSON'
{
  "type": "object",
  "required": ["file", "line"],
  "properties": {
    "file": {"type": "string"},
    "line": {"type": "integer"}
  },
  "additionalProperties": false
}
JSON

autohand --bare --ephemeral -p "Which file and line cause the crash in issue.txt?" \
  --restricted --output-schema answer.schema.json --json local \
  | jq -r .content | jq .

On success, content holds the JSON document as a string, so parse it a second time.

Terminal Bench integration

Terminal-Bench is a public benchmark of terminal tasks that run in containers. Its official harness is Harbor.

What Terminal Bench measures

  • Task resolution rate: Percentage of tasks completed successfully
  • Repeated trials: Each task can run several times (-k) to measure variance
  • Cross-agent comparison: The same tasks run against different agents and models

Running Terminal Bench with Autohand

Harbor is installed with uv and runs agents with harbor run. Autohand is not one of the agents Harbor documents as built in, so you connect it with a custom agent class passed to --agent-import-path. That class installs Autohand Code CLI in the task container and runs autohand --bare -p "<task instruction>" --yes with your credentials in AUTOHAND_PROVIDER, AUTOHAND_API_KEY and AUTOHAND_AI_API_KEY. See Harbor’s documentation for the agent interface.

# Install the harness
uv tool install harbor

# Check the dataset names and flags your installed version supports
harbor run --help

# Run the benchmark with your Autohand adapter
harbor run -d terminal-bench/terminal-bench-2 \
  --agent-import-path "my_agents.autohand:AutohandAgent" \
  -k 3

Sample Terminal Bench tasks

The benchmark includes tasks like:

  • Building Linux kernels from source
  • Configuring web servers with specific requirements
  • File encryption and decryption operations
  • SSL certificate generation and management
  • Data transformation with constraints
  • Machine learning model training pipelines

Building a simple evaluation script

For quick benchmarking without external dependencies, use a standalone runner. It needs Python 3.10 or newer and autohand on your PATH.

Evaluation runner

#!/usr/bin/env python3
"""
Simple evaluation runner for Autohand CLI.
Runs each task in a fresh directory, checks the result, and writes a report.
"""

import argparse
import json
import shutil
import subprocess
import tempfile
import time
from datetime import datetime, timezone
from pathlib import Path

def run_agent(work_dir: Path, task: dict, autohand: str, model: str | None) -> str | None:
    """Run Autohand headless on one task. Returns an error message, or None on success."""
    timeout = task.get("timeout", 300)
    cmd = [
        autohand, "--bare", "--ephemeral",
        "--path", str(work_dir),
        "-p", task["prompt"],
        "--yes",
        "--json", "local",
        "--max-duration", str(timeout),
    ]
    if model:
        cmd += ["--model", model]
    try:
        proc = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout + 60)
    except subprocess.TimeoutExpired:
        return "Timeout"
    lines = proc.stdout.strip().splitlines()
    record = json.loads(lines[-1]) if lines else {}
    if proc.returncode != 0:
        return record.get("message") or f"autohand exited with status {proc.returncode}"
    return None

def verify_task(work_dir: Path, verification: dict) -> bool:
    """Run the task's own checks."""
    for test_cmd in verification.get("tests", []):
        if subprocess.run(test_cmd, shell=True, cwd=work_dir, capture_output=True).returncode != 0:
            return False
    for assertion in verification.get("assertions", []):
        if "file_exists" in assertion and not (work_dir / assertion["file_exists"]).exists():
            return False
        if "file_contains" in assertion:
            path, pattern = assertion["file_contains"]
            target = work_dir / path
            if not target.exists() or pattern not in target.read_text():
                return False
    return True

def run_task(task_dir: Path, autohand: str, model: str | None) -> dict:
    task = json.loads((task_dir / "task.json").read_text())
    work_dir = Path(tempfile.mkdtemp(prefix=f"eval-{task['name']}-"))
    if (task_dir / "setup").exists():
        shutil.copytree(task_dir / "setup", work_dir, dirs_exist_ok=True)
    for cmd in task.get("setup_commands", []):
        subprocess.run(cmd, shell=True, cwd=work_dir, check=True)

    start = time.time()
    error = run_agent(work_dir, task, autohand, model)
    passed = error is None and verify_task(work_dir, task["verification"])
    return {
        "name": task["name"],
        "level": task["level"],
        "category": task["category"],
        "passed": passed,
        "duration_seconds": round(time.time() - start, 1),
        "error": error,
    }

def summarise(results: list[dict], key: str) -> dict:
    groups: dict = {}
    for r in results:
        g = groups.setdefault(str(r[key]), {"total": 0, "passed": 0})
        g["total"] += 1
        g["passed"] += int(r["passed"])
    for g in groups.values():
        g["pass_rate"] = round(g["passed"] / g["total"], 3)
    return groups

def main():
    parser = argparse.ArgumentParser(description="Run an Autohand evaluation suite")
    parser.add_argument("--tasks", required=True, help="Path to tasks directory")
    parser.add_argument("--autohand", default="autohand", help="Autohand CLI command")
    parser.add_argument("--model", help="Model to pass with --model")
    parser.add_argument("--level", type=int, help="Run only one level")
    parser.add_argument("--output", default="eval-report.json", help="Report file")
    args = parser.parse_args()

    results = []
    for level_dir in sorted(Path(args.tasks).iterdir()):
        if not level_dir.is_dir() or (args.level and level_dir.name != f"level-{args.level}"):
            continue
        for task_dir in sorted(p for p in level_dir.iterdir() if p.is_dir()):
            print(f"Running: {task_dir.name}")
            result = run_task(task_dir, args.autohand, args.model)
            results.append(result)
            print(f"  {'PASS' if result['passed'] else 'FAIL'} ({result['duration_seconds']}s)")

    passed = sum(r["passed"] for r in results)
    report = {
        "agent": "autohand",
        "model": args.model,
        "timestamp": datetime.now(timezone.utc).isoformat(),
        "total_tasks": len(results),
        "passed_tasks": passed,
        "pass_rate": round(passed / len(results), 3) if results else 0,
        "by_level": summarise(results, "level"),
        "by_category": summarise(results, "category"),
        "results": results,
    }
    Path(args.output).write_text(json.dumps(report, indent=2))
    print(f"\nTotal: {passed}/{len(results)} ({report['pass_rate']:.1%})")

if __name__ == "__main__":
    main()

Running the script

# Run all evaluations
python evals/scripts/run-eval.py --tasks evals/tasks

# Run only Level 200 tasks
python evals/scripts/run-eval.py --tasks evals/tasks --level 200

# Compare two models on the same suite
python evals/scripts/run-eval.py --tasks evals/tasks --model model-a --output model-a.json
python evals/scripts/run-eval.py --tasks evals/tasks --model model-b --output model-b.json
python evals/scripts/compare-reports.py model-a.json model-b.json

Replace model-a and model-b with model IDs your provider accepts.

Report format

The runner writes a JSON report that is easy to compare across runs.

{
  "agent": "autohand",
  "model": "model-a",
  "timestamp": "2026-10-15T02:32:00+00:00",
  "total_tasks": 40,
  "passed_tasks": 35,
  "pass_rate": 0.875,
  "by_level": {
    "100": {"total": 10, "passed": 10, "pass_rate": 1.0},
    "200": {"total": 15, "passed": 13, "pass_rate": 0.867},
    "300": {"total": 10, "passed": 9, "pass_rate": 0.9},
    "400": {"total": 5, "passed": 3, "pass_rate": 0.6}
  },
  "by_category": {
    "bug-fixing": {"total": 8, "passed": 8, "pass_rate": 1.0},
    "feature-implementation": {"total": 12, "passed": 10, "pass_rate": 0.833}
  },
  "results": [
    {
      "name": "fix-syntax-error",
      "level": 100,
      "category": "bug-fixing",
      "passed": true,
      "duration_seconds": 12.5,
      "error": null
    }
  ]
}

Comparing two reports

A short script prints the pass-rate change per level and lists tasks that changed result:

#!/usr/bin/env python3
"""Usage: compare-reports.py BASELINE.json CANDIDATE.json"""
import json
import sys

base, cand = (json.load(open(p)) for p in sys.argv[1:3])
print(f"Overall: {base['pass_rate']:.1%} -> {cand['pass_rate']:.1%}")
for level in sorted(set(base["by_level"]) | set(cand["by_level"])):
    b = base["by_level"].get(level, {}).get("pass_rate", 0)
    c = cand["by_level"].get(level, {}).get("pass_rate", 0)
    print(f"  Level {level}: {b:.1%} -> {c:.1%}")

before = {r["name"]: r["passed"] for r in base["results"]}
for r in cand["results"]:
    if r["name"] in before and before[r["name"]] != r["passed"]:
        print(f"  {r['name']}: {'now passes' if r['passed'] else 'now fails'}")

To review what the agent did during a run, use --output-format stream-json and keep the event log, or turn on agent traces with autohand traces on to see sessions in Autohand Console.

CI/CD integration

Run evaluations automatically on every release to catch regressions.

GitHub Actions workflow

# .github/workflows/eval.yml
name: Agent Evaluation

on:
  release:
    types: [published]
  workflow_dispatch:

jobs:
  evaluate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Autohand
        run: |
          curl -fsSL https://autohand.ai/install.sh | sh
          autohand --version

      - name: Run evaluations
        run: |
          python evals/scripts/run-eval.py \
            --tasks evals/tasks \
            --output eval-results.json
        env:
          AUTOHAND_PROVIDER: autohandai
          AUTOHAND_API_KEY: ${{ secrets.AUTOHAND_API_KEY }}
          AUTOHAND_AI_API_KEY: ${{ secrets.AUTOHAND_API_KEY }}

      - name: Check pass rate
        run: |
          PASS_RATE=$(jq '.pass_rate' eval-results.json)
          if (( $(echo "$PASS_RATE < 0.85" | bc -l) )); then
            echo "Pass rate $PASS_RATE is below threshold 0.85"
            exit 1
          fi

      - name: Upload results
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: eval-results
          path: eval-results.json

The runner passes --bare, which reads credentials from AUTOHAND_PROVIDER, AUTOHAND_API_KEY and AUTOHAND_AI_API_KEY. See Headless mode for other providers.

Best practices

Task design

  • Clear success criteria: Define exactly what constitutes passing
  • Isolated environments: Each task runs in a fresh directory
  • Realistic complexity: Tasks should reflect actual development work
  • Version control setup files: Keep tasks reproducible across runs

Avoiding contamination

Ensure evaluations measure real capability, not memorization:

  • Use unique identifiers in task files (Terminal Bench uses a canary GUID)
  • Vary surface details while keeping core challenges consistent
  • Regularly refresh task content with equivalent alternatives
  • Monitor for suspiciously perfect scores on novel tasks

Statistical rigor

  • Run multiple trials to establish confidence intervals
  • Report standard error alongside pass rates
  • Use consistent hardware and network conditions
  • Document model versions and configuration

Sample evaluation tasks

Get started with these example tasks across all difficulty levels. The runner above understands tests, file_exists and file_contains; put anything else, such as latency or memory limits, in a test script that exits non-zero on failure.

Level 100: Fix typo in error message

{
  "name": "fix-typo",
  "level": 100,
  "category": "bug-fixing",
  "timeout": 60,
  "prompt": "Fix the typo in the error message in src/utils.js",
  "verification": {
    "tests": ["grep -q 'successfully' src/utils.js"],
    "assertions": [
      {"file_contains": ["src/utils.js", "successfully"]}
    ]
  }
}

Level 200: Add input validation

{
  "name": "add-validation",
  "level": 200,
  "category": "feature-implementation",
  "timeout": 180,
  "prompt": "Add email validation to the user registration endpoint. Return 400 for invalid emails.",
  "verification": {
    "tests": ["npm test"],
    "assertions": [
      {"file_exists": "src/validators/email.js"}
    ]
  }
}

Level 300: Implement caching layer

{
  "name": "add-caching",
  "level": 300,
  "category": "performance",
  "timeout": 300,
  "prompt": "Add Redis caching to the product listing API. Cache should expire after 5 minutes. Invalidate on product updates.",
  "verification": {
    "tests": ["npm test", "npm run benchmark -- --max-p95-ms 50"],
    "assertions": [
      {"file_exists": "src/cache/redis.js"}
    ]
  }
}

Level 400: Fix memory leak

{
  "name": "fix-memory-leak",
  "level": 400,
  "category": "performance",
  "timeout": 600,
  "prompt": "The WebSocket server has a memory leak. Find and fix it. Memory usage should remain stable under sustained load.",
  "verification": {
    "tests": ["npm run load-test -- --requests 10000 --fail-on-heap-growth"],
    "assertions": []
  }
}

Next steps

Last updated on

Was this helpful?

Send Feedback

Help us improve this documentation page. Your feedback is valuable.

We'll only contact you if we need clarification