Replacing Live Endpoints With High-Fidelity API Stubs in Benchmark Suites
Benchmark stubs must keep state, data, and drift in check.

For agent evals, replacing live endpoints with API stubs requires preserving the behavior each benchmark task depends on, including state changes, realistic data, and accurate responses. Multi-step evaluations also need starting states that can be reproduced and realistic failures when they test recovery. High-fidelity stubs let evaluations work without production access, but generic stateless mocks can change the task and give it the wrong score.
Why benchmark suites break when stubs behave like simple mocks
Live endpoints are risky places to evaluate agents whose actions can change records or trigger potentially irreversible operations. ClawsBench, by Li et al., identifies that risk as a reason to evaluate productivity agents in simulated workspaces. If the replacement behaves unlike the service, the benchmark no longer tests the intended task.
A mock that returns the same response regardless of prior calls cannot represent a world in which creates, updates, and deletes have happened. With such a mock, an agent may get a successful response without seeing the changes that should follow. For benchmarks that evaluate sequences of actions, this breaks the connection between decisions and outcomes. The distinction is not what the replacement is called, but whether it preserves the behavior the task requires.
What stateful behavior means for a stub and why benchmarks depend on it
A stateful stub maintains and updates a world model across sequential calls within a session. A stateless stub instead returns a fixed response for a matching request, regardless of preceding operations. Consider a workflow that creates a record, fetches it, cancels it, and fetches it again. The final read must reflect the cancellation. Otherwise, the benchmark has removed a dependency that the agent would have to handle against the real service.
That dependency supplies much of the difficulty in planning, error recovery, and cross-service coordination. Without it, tasks can become trivially easy or nonsensical because actions do not accumulate into an inspectable world. ClawsBench implements its Gmail, Slack, Calendar, Docs, and Drive mock services as standalone REST APIs backed by SQLite, with full state management and deterministic snapshot/restore. EnterpriseOps-Gym, from ServiceNow, similarly uses an interactive sandbox with 164 database tables to test long-horizon, stateful, multi-tool workflows. Although maintaining state makes a stub harder to build, omitting it changes what a multi-step benchmark measures.
How realistic pre-seeded data shapes what a benchmark can and cannot detect
Persistent state is necessary for many tasks, but the starting state also determines their difficulty. An empty database or a uniform collection of records cannot represent the density and variety of a live environment. References between records, conflicting states, and edge-case entries create decisions that sparse fixtures may remove. The data defines what can be tested. An agent that succeeds in a simplified world may never encounter the ambiguity or relational complexity present in the intended task.
ClawsBench’s Slack mock covers 45 of 83 Slack Web API endpoints with 57 golden fixtures and 161 conformance tests. That fixture corpus is part of the benchmark’s design. For cross-service tasks, realistic data also needs ground truth that agrees across services. The same clients, invoice numbers, and dates should agree across Slack, email, payment, and document worlds. Inconsistent records can make a task difficult for artificial reasons, just as sparse records can make it artificially easy. Even a coherent, well-populated world can become misleading, however, if its API behavior drifts away from the service it replaces.
The drift problem: how stubs silently diverge from the APIs they replace
A stub can accurately reflect an API when built and become inaccurate as that API evolves. New query parameters, changed field names, larger response shapes, and revised edge-case behavior do not automatically propagate into a replacement. The benchmark may continue to run successfully. Its score then describes behavior against a historical snapshot of the service it claims to represent.
The Kalshi nightly drift detection workflow in TexasCoding/kalshi-python-sdk provides concrete examples from October–November 2026. These include a missing subaccount_type mapping in MarginPosition and a new exclude_markets query parameter on GET /events/{event_ticker}. A stub built before those changes would not represent the updated behavior without corresponding maintenance. Such omissions can remain invisible to the benchmark because the outdated replacement still accepts requests and returns responses.
ClawsBench addresses this problem through per-service, append-only API quirk logs that record surprising real-API behavior found during fixture analysis. Its fixtures were captured or refreshed between 2026-03-19 and 2026-03-27. Scheduled refreshes and quirk logs provide a foundation, while automated, continuous verification is needed to detect divergence systematically. Benchmark validity requires the replacement to continue representing the service even as its own tests continue to pass.
Why LLM-generated stubs add an additional fidelity risk that benchmark authors should account for
Drift introduces divergence over time, while generated stubs can introduce it at creation. An LLM or coding agent can produce an artifact that executes successfully but returns incorrect values, raises the wrong exceptions, or represents interactions incorrectly. Execution is only the first test. If the benchmark accepts it as evidence of accuracy, errors in the replacement become hidden assumptions in the evaluation.
MockBench, by Ning et al., evaluates six LLMs and three coding agents on 165 mock artifact generation tasks from real-world Java and Python projects. It distinguishes executability from behavior fidelity and interaction-fault detection. Coding agents do much better than LLMs alone on executability, but those gains do not always lead to better behavioral accuracy or fault detection. For benchmark authors, the lesson is to treat generated stubs as drafts requiring conformance verification against golden fixtures. Hand-built stubs need the same scrutiny because the acceptance criterion is agreement with the real dependency.
What fault injection requires from a stub in a benchmark context
A benchmark that presents only well-formed, successful results measures best-case behavior, even if its tasks are otherwise realistic. To test resilience, a benchmark needs failures within the task itself. That means the stub must support the failure modes relevant to the behavior being scored.
Tests of agent behavior need infrastructure-level faults such as latency, connection drops, and 5xx errors, but they also need other kinds of faults. An agent may handle a structurally valid 503 correctly yet fail when a response is structurally valid but semantically wrong. A 429 with a correct Retry-After header tests different behavior from a 429 without that header. Both differ from a 200 with a subtly malformed body. Programmable fault injection therefore needs control over response content as well as transport behavior.
Timing also changes what a failure tests. SequenceFI (2026) addresses temporal fault injection in microservice systems by placing faults at precise points in a call sequence. That capability maps directly to multi-step error-recovery benchmarks, where a failure occurs after earlier operations have changed the world. A stub that cannot place the relevant fault at the relevant step cannot reproduce the conditions under which the benchmark intends to evaluate recovery.
How the fidelity requirements change depending on what the benchmark is measuring
Single-service, single-turn tasks need accurate schemas and realistic data, but stateless stubs can work when the task has no prior-state dependency. Multi-turn, cross-service tasks need persistent state and data that agrees across services. They also need snapshot/restore so evaluation episodes start reproducibly and remain isolated.
Safety evaluation adds a different set of demands. A benchmark that tests refusal of destructive actions, permission boundaries, or avoidance of data exfiltration needs deterministic scenarios in which agents face those choices. A stub limited to expected successful responses cannot present the necessary challenge.
ClawsBench’s 44 structured tasks cover single-service, cross-service, and safety-critical scenarios. Its reported scaffolding effect is substantially larger than the spread attributable to model differences, demonstrating how strongly evaluation conditions can shape outcomes. The paper’s scaffolding includes domain skills and a coordinating meta prompt, so that finding should not be read as an isolated measurement of stub fidelity. It does show that model capability alone cannot explain how well an agent does on a benchmark. Stub accuracy also matters to validity because it shapes the world in which the agent acts.
The architectural properties a stub system needs to satisfy these requirements in practice
Within a session, creates, updates, and deletes must change the world that later reads expose. Across sessions, snapshot and restore must return that world to a known starting state. These are distinct responsibilities. Persistent state without reset makes successive runs incomparable, while reset without persistence leaves multi-step tasks disconnected from their consequences.
The initial snapshot must also have realistic records that agree with each other. Its responses need to be checked on a schedule against golden fixtures captured from the real API, using conformance tests that cover the behavior it supports. ClawsBench’s per-service conformance suites illustrate this verification layer. Fixtures show how the replacement should behave, and the tests check it against them.
Programmable fault injection adds control over latency, rate-limit responses, partial failures, and semantically malformed results at the call level. Parallel execution introduces a separate isolation requirement. Large-scale evaluations and RL training environments need many containerized instances without shared state bleeding between episodes. Horizontal scalability is therefore not just a throughput property in this setting. It must preserve the independence of the worlds being evaluated, so that running more episodes does not change the conditions of each one.
How can you use an API for agent evals when choosing or building stubs?
For a specific benchmark, the practical starting point is its task structure. Before testing a stub system, authors should check whether tasks depend on prior writes, use more than one service, test recovery, or involve safety-critical decisions. Those dependencies establish which properties are non-negotiable. A single-turn response test and a multi-service planning task do not justify the same implementation, even when both use the same underlying API.
The evaluation should then examine persistent state, snapshot/restore, continuous verification, realistic pre-seeded data, programmable fault injection, and horizontal scalability against those requirements. Each missing property creates a particular validity threat where the task depends on it. Continuous verification is the minimum bar because a replacement that is not regularly validated can drift regardless of its initial quality. Feature coverage alone cannot answer whether its responses remain faithful.
For RL and large-scale automated evaluation, isolated, horizontally scalable containers are particularly well suited to giving each episode its own instance. Snapshot/restore supplies repeatable starting conditions, while isolation prevents one run’s writes from affecting another. Where an existing verified simulator does not cover the required service, the ClawsBench approach provides a minimum viable methodology for a hand-built replacement through captured golden fixtures, an append-only quirk log, and scheduled refreshes. The acceptance decision should rest on whether the stub preserves the specific behavior the benchmark claims to measure.


