@yielded/agent-testing replaces the model provider with scripted responses while retaining the
real interpreter, tools, and output validation. Use it to verify integration behavior without
credentials, network calls, or model variance.
Provides the native Effect AI LanguageModel and this inspection service.
Supplying the extra inspection service does not add it to model-call
requirements. Each model invocation consumes one turn before assertion and
turn-kind validation.
The reason why the model finished generating the response.
reason:"stop",
FinishPartEncoded.usage: {
readonly inputTokens:{
readonly uncached?:number|undefined;
readonlytotal?:number|undefined;
readonlycacheRead?:number|undefined;
readonlycacheWrite?:number|undefined;
};
readonlyoutputTokens: {
readonly total?:number|undefined;
readonlytext?:number|undefined;
readonlyreasoning?:number|undefined;
};
}
Token usage statistics for the request.
usage:{
inputTokens:{
readonlyuncached?:number|undefined;
readonlytotal?:number|undefined;
readonlycacheRead?:number|undefined;
readonlycacheWrite?:number|undefined;
}
Information about input (i.e. prompt) token utilization.
inputTokens:{
total?:number|undefined
The total of number of input (i.e. prompt) tokens used.
total:1},
outputTokens:{
readonlytotal?:number|undefined;
readonlytext?:number|undefined;
readonlyreasoning?:number|undefined;
}
Information about the output (i.e. response) tokens used.
outputTokens:{
total?:number|undefined
The total of number of output (i.e. response) tokens used.
total:1}},
},
],
termination:{
readonly_tag:"Complete";
}|{
readonly_tag:"Fail";
readonlydescription:string;
}|{
readonly_tag:"Hang";
}
termination:{
_tag:"Complete"
_tag:"Complete"},
},
]),
);
Provide TestModel in place of the provider Layer for a text-output Agent. Keep the application’s
runtime and handler composition. Each scripted Turn is consumed once; inspection exposes requests,
remaining turns, and assertExhausted. Hooks can inspect the normalized prompt or observe stream
finalization. Scripts can also emit tool calls, fail, or wait for interruption.
Choose assertions for your integration’s actual risks: authorized tools, expected output, resource
cleanup, or the outcome after restart. A scripted model proves how the runtime handles the supplied
response; it does not prove that a real model will choose that response.
The testing package includes
executable travel-planner and researcher fixtures. Use live evaluation separately when the question
is model quality.
Run the shared storage-port cases against disposable storage to check each adapter’s contract.
The @yielded/agent/testing/*-store-conformance modules and
@yielded/agent/testing/submission-ledger-conformance expose those cases independently.
For coordinator recovery, run durableCoordinatorConformance from
@yielded/agent-testing/durable-coordinator-conformance in a TestClock-backed environment such
as it.effect. Provide one combined Layer containing SubmissionLedger, ThreadStore,
SettlementPublisher, StorageOwner, and Digest from effect/crypto/Digest. Use pristine disposable storage with native
Thread verification. The helper discovers six scenario paths, injects faults, and checks bounded
recovery through settled history; violations fail with DurableCoordinatorConformanceViolation.
See the coordinator conformance module
for its contract.
Injected faults do not establish recovery after process loss or eviction. Exercise actual restarts
separately against the host and storage you deploy. Likewise, the reusable
@yielded/agent-testing/code-executor-conformance checks executor behavior and declared metadata;
verify isolation against the actual executor.