localhost address and only handles single-turn conversations. Real projects soon run into these problems: local and staging addresses differ, you want to compare two models, and you want to check tool calls. This page shows how to turn that minimal Adapter into an integration you can keep using.
Choose an integration first
AI SDK applications
For applications built on the Vercel AI SDK, use a built-in adapter to connect to the existing HTTP interface directly, with no handwritten mapping.
Coding Agents such as Claude Code and Codex
Use a built-in Sandbox Agent and run the Agent in an isolated environment.
Other AI applications
Handwrite an Adapter’s
send function. If the application already has OTel instrumentation, you can also connect OTel to see the call waterfall.defineAdapter; see Evaluate a Custom Application.
Connect to the real entry point
When the system under test is a separate HTTP service, the Adapter should call the interface actually used in production, even if the service code and the evals live in the same repository. Do not switch to calling a function in-process for convenience:- The HTTP layer, serialization, middleware, and streaming are all bypassed, so a passing eval does not mean production behavior is correct.
- An HTTP Adapter connects to local, staging, or production by changing one
baseUrl; an in-process call can only run in the current codebase.
send. Do not build an extra service just to follow the HTTP pattern.
Starting and stopping the service under test is not the Adapter’s job. First start the service with the project’s own dev command, deploy script, or CI, confirm the health check passes, then run the evals. When the service cannot start, let the eval report the error honestly. Do not pass off a hard-coded reply as a run result. For services that need to start and stop automatically for each eval run, see Start Shared Experiment Services.
Two channels for configuration
The easiest thing to get confused about in an integration is “where should this value come from”. There are only two channels:- Where to connect and how to authenticate goes through the Adapter factory. Environment-level configuration such as URLs, auth headers, and protocol switches is written as factory parameters in the Experiment file.
- Which configuration to run this time goes through
ctx. NiceEval passes the Experiment’smodelandflagstosendthroughctxevery turn. The Adapter does not interpret them; it forwards them to the application unchanged.
model and flags:
baseUrl:
ctx each turn:
Report progress and anomalies
When calling upstream is slow or the response is incomplete, report throughctx instead of calling console.log directly:
- The Agent under test replied normally, but reports failure for this turn itself: return
status: "failed". The run reaches a conclusion, usuallyfailed. - The connection failed or the response cannot be parsed, so the eval cannot continue: throw an exception. The run is recorded as
errored, and the terminal gives a locator. - It can continue, but there is an anomaly worth recording: write a
ctx.diagnostic. It does not change pass or fail.
niceeval show @<locator>.
Where to look first when it does not work
fetchthrows directly, for example connection refused: the application is not running, or the URL is wrong. First send one request to the same interface withcurlto confirm.t.succeeded()fails: the request went out, but the Adapter returnedfailed. Check how the application’s error response is mapped tostatus.- Only content assertions fail: the integration works. Use
niceeval show @<locator> --executionto see what the application actually returned, then decide whether to change the assertion or the application.
Add more capabilities as needed
A minimal integration can only check reply text. Each capability below changes only the Adapter, and existing evals need no changes:
For how much cooperation each capability needs from the application, see Tier.
Reference implementations
examples/zh/tier1 has five runnable integration examples: AI SDK v7, Claude SDK, Codex SDK, Pi SDK, and LangGraph. They cover tool call assertions, multi-turn isolation, HITL approve and reject, and the call waterfall. For the full fields of send, see Adapter; for all official adapters, see Official Adapters.