Composing an Agent Eval Harness Around Simulated API Backends That Scale Horizontally
Seeded, session-isolated simulators let parallel agent evals score reproducibly.

To use an API for agent evals without hitting production, run agents against a seeded, stateful simulator and score the resulting backend state. A production-grade harness combines session-isolated state with horizontally scalable simulator replicas, while cassette replay controls model-call variability. The central architectural requirement is to preserve each run’s state without allowing parallel runs to affect one another.
Why evaluating agents against live APIs breaks the feedback loop that evals require
An evaluation needs a reliable chain of attribution. A scenario runs, an outcome follows, and the engineer can connect that outcome to agent behavior. Live APIs weaken that connection through non-deterministic responses and rate limits, while costs and secret management complicate repeated execution. The agent-eval-harness project found that, with one trial per scenario, a single run can shift a model’s pass rate by 2.4 percentage points. A changed score therefore needs an explanation beyond the number itself.
The project illustrates a controlled alternative with a tool-calling customer support agent. Its fake e-commerce backend is in-memory, seeded, and governed by a frozen clock. Model calls are recorded to cassettes so CI can replay them without API keys. Backend behavior and model-call replay address different sources of variability, rather than treating reproducibility as a property of the prompt alone.
Even a predictable backend becomes unsuitable for comparison if one run changes records another run reads. The architecture must therefore solve two interlocked problems, namely non-determinism and shared mutable state. Simulation and replay control the former, while session isolation prevents the latter from becoming cross-test contamination.
What stateful simulation actually means and why stateless mocks cannot substitute for it in agent evals
In a stateful simulator, what happens earlier affects the responses that come later. Consider a payment that is created, then captured, then refunded. A stateless mock that always returns “captured” can make a workflow appear successful before any capture occurs. The test then rewards a sequence the real API would reject. Stateful simulation makes changes to a resource’s state part of what the test checks.
Time belongs in that state as well. With the project’s frozen clock, refund eligibility depends on a date the project controls. In one early run, the current date was omitted and two models refused a valid refund. That failure shows why seeding must include both records and the information needed to interpret them. An order date cannot establish eligibility without a consistent “now.”
The project determines task success from final backend state. It also records a policy failure when the agent attempts a forbidden tool call, regardless of what the agent reports afterward. This separates completed work from persuasive language.
Stateless mocks remain simpler to maintain and parallelize. They are suitable when requests can be tested independently, but cannot substitute for workflows whose correctness depends on previous writes. Refund windows, identity checks, and multi-turn clarification require rules and context that fixed responses alone do not exercise. The price of that capability is state management and reset complexity.
The cross-test contamination problem and how session-isolated overlay stores solve it
Session-isolated overlay stores separate shared starting data from private changes. A session cookie or header identifies the sandbox on every request. POST, PUT, PATCH, and DELETE operations write to a temporary session table scoped to that identifier. Reads combine the immutable seed with only that session’s changes.
A read request to /orders makes the merge concrete. The response includes seed orders and orders created within the requesting session, applies that session’s updates, and excludes orders deleted within it. Copy-on-write applied to API state keeps orders created within each session private to that session. Only the deltas need session-local storage.
Starting a session does not require duplicating the full dataset, and tearing it down is a single table drop. The same isolation principle extends to temporal state, with each session receiving a consistent “now” under harness control. Resource state and time then remain stable inputs to the scenario.
The practical design principle is to keep most tests stateless and reserve stateful execution for complex workflows. Those workflows need isolated data and must survive random ordering. Overlay stores make those requirements compatible with parallel execution, rather than forcing the harness to serialize tests merely to protect their starting conditions.
How do you scale automated agent evals with containerized simulated backends?
The simulated backend can run as replicated HTTP servers because session state resides in the overlay store. Any replica can serve a session request if it can reach the same session store. Stateful behavior does not require a stateful HTTP process. The distinction is what makes horizontal scaling possible.
For higher parallelism, the session store can move to a shared fast store such as Redis or an equivalent. Replicas read and write overlays there while continuing to serve the simulator’s API. So replicas can be added without copying session histories from one simulator process to another. The shared store provides the state boundary, and the session identifier selects the isolated view.
Large parallel runs against a live third-party API incur request costs and encounter throttling. Requests against a containerized simulator avoid those third-party charges and rate limits, though how much it can handle still depends on its own infrastructure.
The container is therefore not the isolation mechanism. Packaging a server that still mutates one shared dataset would still allow parallel runs to affect one another. Horizontal replication becomes useful only after the data architecture has made each session’s writes private.
Fault injection as a first-class dimension of the eval scenario suite, not an afterthought
A controlled backend must reproduce failure as deliberately as success. Otherwise, an eval can establish that an agent completes a healthy workflow without establishing what happens when a tool times out or returns an error. The project’s scenario YAML accepts injected tool faults together with backend fixtures. Failure conditions thus belong to the scenario definition. They are not incidental disruptions to the test environment.
The fault catalog includes randomized latency, slow chunked responses, dropped connections, HTTP 5xx responses, rate-limit 429s, and DNS failures. For reproducible evaluation, randomized behavior must remain under scenario control. Assertions can then examine circuit breakers, bulkheads, and timeout trip/reset behavior. Evaluation should assess whether the agent and harness handle the specified failure correctly.
Fault scenarios need to be scored separately from happy-path scenarios. An agent that retries correctly on a 429 must be distinguishable from one that crashes. The project calculates its overall score as 0.5 task + 0.2 tool accuracy + 0.2 policy + 0.1 handoff − 0.05 per unnecessary call. Fault-handling tests should contribute to tool accuracy and policy rather than disappear inside a single completion rate.
Scripted fault injection and chaos engineering serve different purposes. The former supplies deterministic scenario conditions, while unplanned failure injection explores failures those scripts miss. Gremlin, LitmusChaos, Chaos Mesh, and AWS Fault Injection Service extend that work to infrastructure resilience, beyond the narrower task of repeatable agent scoring.
Designing the scenario suite so that scores are meaningful and not artifacts of harness choice
Harness-Bench establishes that measured agent performance depends partly on the harness. No single harness performs best across all backends, and the same model’s full-credit rate varies materially between harnesses. Model comparison therefore requires a shared, versioned execution environment in which the harness stays fixed and the agent varies. Changing both obscures which change produced the result.
Coverage must also test the agent’s decision boundaries. The project’s 42 scenarios include ambiguous or incomplete requests, refunds outside the 30-day window, prompt injection inside customer messages, tool errors and timeouts, multi-turn clarification, and identity checks. Its 2026-10-14 run found that most policy failures involved date arithmetic. Models misjudged whether orders fell inside the refund window, while social-engineering text elicited forbidden tool calls more effectively than fake system text.
Static datasets alone do not capture those branching paths. A scripted or LLM-played simulated user allows later turns to respond to the agent’s choices. The environment must also test discrimination among available actions. MCPAgentBench uses simulated MCP tools in a dynamic sandbox, with candidate tool lists containing both correct tools and distractors.
AgentCompass supports a complementary separation of responsibilities. It decouples Model, Benchmark, Harness, and Environment so configurations can change without reimplementing execution logic. For a custom harness, that separation allows scenario coverage to expand without silently changing the machinery used to compare agents.
What pre-seeded realistic data contributes that empty sandboxes cannot
With an empty sandbox, fixtures have to be created for every scenario. That increases authoring work and leaves out failures that emerge only when the agent must navigate a populated environment. Pagination requires enough records to paginate, while search disambiguation requires plausible competing matches. The values in particular fields can also bring policy edge cases into play.
Vendor sandboxes provide a useful first tier. Stripe test mode and the PayPal developer sandbox offer facilities including test card numbers, simulated webhook events, and transaction lifecycles. Their boundaries remain important. Stripe Sandbox payments do not run through real card networks, and PayPal (Braintree) sandbox test values do not work in production. Stripe also states that duplicate event deliveries can occur and that undelivered events are retried for up to three days.
Locally hosted simulators provide a different kind of control. They can start from arbitrary fixtures, run offline, and enforce the event ordering a scenario requires without depending on vendor sandbox uptime. PayPal requires an HTTP 2xx acknowledgment for each webhook and retries failed deliveries multiple times over 3 days. A simulator can reproduce a specified retry sequence deterministically, whereas a vendor sandbox cannot be forced into that sequence on demand.
Temporal fixtures complete the seed layer’s role. Stripe’s test clock object simulates time progression for subscription billing scenarios, making it a useful capability for local simulators to replicate. A frozen clock supports a fixed eligibility decision, while controlled progression supports workflows whose correct state changes as time advances.
How the harness components compose into an end-to-end system an engineering team can operate
The operational system begins with a scenario as its unit of work. YAML declares fixtures, injected faults, a scripted or LLM-played user, and expected outcomes. The session layer gives that scenario a private view of the seed, and the simulated backend enforces business rules against it. Execution then runs through the conversation loop, agent loop, tool schemas, cassette middleware, cost meter, and scorer. Each boundary has a distinct responsibility.
Those boundaries determine how failures can be explained. The harness owns step limits and cost checks, while the scorer reads final backend state. Reporting aggregates results by model, category, and fault type, with per-scenario transcripts for attribution.
Cost control belongs in this execution contract. Harness-Bench found that, for one evaluated model, a more expensive harness configuration incurred nearly three times the API cost of a cheaper configuration while achieving a lower full-credit rate. Budget caps for each run and cassette replay keep evaluation costs in check without assuming that spending more leads to better results. The project’s cassettes use a SHA-256 of the request as the key and store request and response bodies, never headers. Replay provides a clear boundary to the live model API, allowing CI to run without keys or network and finish in seconds.
For integrations with Slack, GitHub, Stripe, Kalshi, PayPal, Resend, or Lob, fidelity verification is a major investment because a drifting simulator can silently reward incorrect behavior. The simulator must therefore be checked against the live API on an ongoing basis before each release, as a separate part of the work from ordinary offline evaluation.
That separation gives the architecture its lasting value. Engineers can change scenario coverage, simulator fidelity, execution controls, or reporting without rebuilding unrelated layers. The system is composable precisely because each layer solves one problem cleanly and exposes that responsibility through a defined interface.


