Architecture¶
WARNING
This documentation is almost entirely "vibe coded"; while a helpful resource for humans and agents to understand this codebase, it should not be considered a source of ground truth in the way documentation normally is, and the user is responsible for verifying that all instructions given here are safe.
This page explains how ABC Runner is put together today.
Overview¶
ABC Runner is a benchmark orchestrator built on the automaton engine. The
automaton library owns the sandboxed execution engine (automaton.Sandbox),
the loopback model proxy (automaton.proxy.ModelProxy), and the layered
container build mechanism (automaton.ContainerManager). abc_runner supplies its
container templates and task-group runtime layers to automaton's engine and
focuses on benchmark-specific concerns: tasks, hidden verification, PASS/FAIL
semantics, results, and orchestration.
The project is easiest to understand if you read it as a concrete pipeline rather than as an abstract framework.
Each benchmark run combines four things:
- a task inside a resolved task group (
<group>/<task>/) - a harness under
harnesses/<harness>/ - a runtime container built for
(harness, task_group) - hidden verification injected after the agent finishes
graph TB
CLI["User CLI"]
Runner["Benchmark<br/>Runner"]
Container["Runtime<br/>Container"]
Agent["Agent<br/>(Harness)"]
Proxy["automaton<br/>ModelProxy"]
Workspace["Workspace<br/>(visible to agent)"]
Verification["Verification<br/>(hidden until end)"]
Result["Result<br/>PASS/FAIL"]
CLI --> Runner
Runner --> Container
Container --> Agent
Agent --> Workspace
Workspace --> Verification
Verification --> Result
Proxy -.-> Agent
Runner --> Proxy
style Verification fill:#f9f,stroke:#333,stroke-width:2px
style Result fill:#9f9,stroke:#333,stroke-width:2px
The Main Pieces¶
The main benchmark-specific pieces, all of which abc_runner owns:
- tasks, grouped inside self-contained task groups (
<group>/<task>/) - harnesses, under
harnesses/<harness>/ - layered runtime containers, built from ABC Runner templates plus each group's own template
- hidden verification, injected after the agent finishes
Package Root vs. Task Groups¶
ABC Runner draws its runtime assets from two distinct places:
- The package root holds ABC Runner-owned assets:
harnesses/and the base and harness container templates undercontainers/. It ships in the wheel and is resolved byabc_runner.config.get_package_root. - Task groups (benchmarks) are not part of the package root. They are
self-contained, external, installable directories discovered at runtime (see
Task Group Discovery). Only the tiny bundled
smoke_testgroup ships in the wheel.
Repository Layout¶
The package root is organized around the ABC Runner-owned pieces:
harnesses/
opencode/
opencode-hybrid/
containers/
base.Dockerfile.jinja2
harnesses/
opencode.Dockerfile.jinja2
opencode-hybrid.Dockerfile.jinja2
A task group is a self-contained, relocatable directory that carries its own runtime container template:
Container Layering¶
Runtime containers are built in three layers:
Concrete template sources:
<package_root>/containers/
base.Dockerfile.jinja2
harnesses/
opencode.Dockerfile.jinja2
opencode-hybrid.Dockerfile.jinja2
<group_dir>/
Dockerfile.jinja2 # the task-group runtime layer, inside the group
The base and harness templates are ABC Runner-owned and live in the package
root. The runtime (task-group) layer template lives inside the resolved group
directory as Dockerfile.jinja2, so a group ships its own runtime layer.
The runner never executes a harness-only container. It always uses the final harness-plus-group runtime. That is one of the most important facts to keep in mind when reading the rest of the codebase.
Execution Model¶
The runner stages a fresh run directory, copies in the task workspace, runs the task build step, runs the harness, injects hidden verification, and then runs verification in the same runtime container. That common environment across the whole run is deliberate.
Main Components¶
Runner¶
abc_runner.runner.BenchmarkRunner orchestrates the full benchmark lifecycle,
delegating sandboxed execution to the automaton engine.
BenchmarkRunner is the orchestration layer. It is responsible for the overall
control flow of a benchmark run, not for solving tasks itself.
Responsibilities:
- resolve the task and agent configuration
- create the run directory and stage runtime files
- run
build_env.shin the final runtime container viaautomaton.Sandbox.run_command - start
automaton.proxy.ModelProxy - run the harness in the same runtime container via
automaton.Sandbox.run_agent - inject hidden verification files after the agent completes
- run verification via
automaton.Sandbox.run_commandand writeresult.json,metadata.json, andusage.json
ModelProxy¶
automaton.proxy.ModelProxy is a split proxy provided by the automaton engine.
It gives the harness controlled access to the upstream model API while keeping
the harness in a loopback-only network namespace. The point is to keep the
model-facing agent from simply "leaving" the isolated benchmark container and
talking directly to arbitrary external services while still preserving access to
the configured model endpoint.
sequenceDiagram
participant Agent as Agent in Container
participant Proxy as Sandbox Proxy on Sandbox localhost
participant Broker as Host Broker
participant API as Upstream API
Agent->>Proxy: HTTP request
Proxy->>Broker: bridged request over socketpair
Broker->>API: forward + auth header
API->>Broker: response
Broker->>Proxy: bridged response
Proxy->>Agent: response
Note over Proxy,Broker: logs traffic to model_proxy.log
The proxy exists so that harnesses can talk to sandbox-local localhost while the host side manages credentials and upstream network access.
Key properties:
- exposes sandbox-local localhost to the harness
- injects credentials on the host side
- keeps secrets out of task files
- logs traffic for debugging
For the split-proxy/socketpair internals and the sandbox-side injected helper,
see the Automaton documentation. The automaton engine handles the two-process
layout (host-side broker and sandbox-side helper serving 127.0.0.1:18080)
while abc_runner stages the per-run directory and passes the proxy configuration
overrides to automaton.Sandbox.
Task System¶
Tasks are filesystem-defined benchmark problems. They are not separate database objects or registry entries; the directory structure is the definition. Tasks live inside self-contained task groups:
The agent sees prompt.md and workspace/. It does not see verification/
until execution is finished. This hidden-verification structure is central to
how the project works.
Task Group Discovery¶
Task groups are not required to live in the source tree. They are discovered at
runtime by abc_runner.groups.GroupResolver from a prioritized set of search
roots, analogous to directories on the shell PATH (each root contains task
groups as <root>/<group>/ or <root>/<group>.sqfs). Priority, highest first:
- the
--task-dir <dir>CLI flag - the colon-separated
TASK_PATHenvironment variable (left-to-right) - the installed root
~/.abc-runner/tasks, populated byabc-runner install
The first root that provides a given group id wins; lower-priority roots that
also define it are shadowed with a warning. abc-runner install materializes a
task group into the installed root from a directory, a .sqfs image, or a
.tar.gz/.tgz archive. The bundled smoke_test group is auto-installed on
first use.
A group may be delivered as a <group>.sqfs image, which is interchangeable
with a directory: ABC Runner mounts it read-only with squashfuse and copies it
to a temporary directory before use.
Heavy Benchmarks¶
Heavy benchmarks with large or generated workspaces are built and published from
a separate benchmarks monorepo and shipped as expanded workspaces inside a
task group, installed via abc-runner install. There is no runtime workspace
synthesis; every task ships an expanded workspace/ on disk.
Harness System¶
Harnesses define how a particular agent is invoked. They are the adapter layer between ABC Runner's run protocol and the behavior of a specific agent tool.
Typical harness contents:
The harness script receives staged paths for:
- workspace
- task prompt
- system prompt
- models config
- harness config
- output directory
- timeout
The current repository ships four harnesses with that interface:
opencode: single-agent OpenCode harnessopencode-hybrid: planner/builder OpenCode harness that maps two configured models ontoplan_modelandbuild_modelroles viaharness_configcodex: single-agent OpenAI Codex CLI harness, which feeds the prompt on stdin and captures Codex's JSONL event stream (see Codex Harness)claude-code: single-agent Anthropic Claude Code CLI harness, which feeds the prompt on stdin, restricts the agent's tool set, and speaks the Anthropic Messages API (see Claude Code Harness)
Container Manager¶
automaton.ContainerManager provides the layered container build mechanism.
abc_runner's abc_runner.container.ContainerManager subclasses it and supplies a
ContainerLayout. The base and harness templates come from the package root
(containers/base.Dockerfile.jinja2 and containers/harnesses/); the runtime
(task-group) layer template comes from the resolved group directory
(<group_dir>/Dockerfile.jinja2). The actual rendering, Charliecloud image
building, and runtime directory conversion are handled by automaton.
Built container artifacts live under:
Shared Charliecloud image storage lives under:
Execution Flow¶
The run itself is easier to follow in phases.
1. Setup¶
- Resolve task from
--taskand optional--task-group - Resolve the selected agent into harness, models, and harness config
- Resolve the final runtime container for
(harness, task.group_id) - Create the result directory
- Copy the task workspace into the run directory
- Stage runtime files such as
prompt.md,build_env.sh, and harness assets
2. Environment Build¶
- Run
build_env.shinside the final runtime container viaautomaton.Sandbox.run_command - Create any task-local environment needed for the benchmark
3. Agent Execution¶
- Start
automaton.proxy.ModelProxy - Generate
models_config.yamlandharness_config.yamlfor the harness - If sandboxing is enabled, stage the sandbox helper and launch the harness in a loopback-only namespace with the helper serving sandbox-local localhost
- Run the harness inside the same final runtime container via
automaton.Sandbox.run_agent - Let the agent modify the staged workspace autonomously
4. Verification¶
- Inject
verification/into the result directory after the agent completes - Run
verification/verify_solution.shinside the same runtime container viaautomaton.Sandbox.run_command - When sandboxing is enabled, run verification through the same sandbox helper and namespace used for the harness
- Parse PASS or FAIL from verification output
5. Results¶
- Write
result.json - Write
metadata.json - Write
usage.json
Data Flow¶
flowchart TD
Start([Input:<br/>task, agent])
Start --> Resolve[Resolve task, harness,<br/>model, container]
Resolve --> Stage[Stage run directory<br/>and workspace]
Stage --> BuildEnv[Run build_env.sh<br/>via automaton.Sandbox.run_command]
BuildEnv --> Proxy[Start automaton<br/>ModelProxy]
Proxy --> Harness[Run harness via<br/>automaton.Sandbox.run_agent]
Harness --> Inject[Inject hidden<br/>verification]
Inject --> Verify[Run verification via<br/>automaton.Sandbox.run_command]
Verify --> Save[Write result.json<br/>and metadata.json]
Save --> End([PASS / FAIL /\nENDPOINT_ERROR / HARNESS_ERROR])
style Start fill:#e1f5ff
style End fill:#d4edda
style Verify fill:#fff3cd
Result Layout¶
Results are organized by agent archive, task group, and task id:
Each run directory contains the workspace delta (compressed result format), harness output, verification artifacts, and machine-readable result metadata.
Important Runtime Facts¶
- task paths are canonical in the filesystem
- metadata supplements paths but does not replace them
- runtime containers are harness-plus-group, not harness-only
- hidden verification is injected after agent execution, not exposed up front
build_env.shkeeps host networking even when sandboxing is enabled- harness and verification share the same loopback-only sandbox behavior by default
- live harness output still streams to the terminal in sandbox mode even though the helper also records it to per-run log files
Build And CI Model¶
CI operations are documented in:
docs/developer-guide/ci-cd.md
That page covers:
- the test job (editable install of the sibling
automatoncomponent + this project, thenpytest) - portable test-runner requirements, with container tools needed only for container integration checks
- a separate documentation runner, with optional publishing configured for the chosen hosting service
The sibling ../abc-ci component provides CI orchestration; see its README
from the monorepo checkout. This component does not include deployment-specific
pipeline YAML.
Note that ABC Runner is not a published package: there is no wheel build and no release flow.