ExAgent. Testing
(ExAgent v3.0.0)
View Source
Per-run tool substitutes for integration tests using an ExAgent.Fixture.
Stability — Stable.
Summary
Functions
Return a strict view of an open cassette. Each admitted tool name must have a substitute accepting the validated arguments, or the context and arguments. Substitutes use the normal tool return contract. An empty map rejects all admitted calls. Output function substitutes take the validated output and optionally its context, and use the output function return contract. Recording and replay both honor the map.
Types
@type output_stub() :: (term() -> ExAgent.Output.function_result()) | (term(), ExAgent.RunContext.t() -> ExAgent.Output.function_result())
@type tool_stubs() :: %{ optional(String.t()) => ExAgent.Tool.callback() | output_stub() | :delegate }
Functions
@spec with_tool_stubs(ExAgent.Fixture.t(), tool_stubs()) :: ExAgent.Fixture.t()
Return a strict view of an open cassette. Each admitted tool name must have a substitute accepting the validated arguments, or the context and arguments. Substitutes use the normal tool return contract. An empty map rejects all admitted calls. Output function substitutes take the validated output and optionally its context, and use the output function return contract. Recording and replay both honor the map.
The candidate :delegate variant runs a durable descriptor's journaled
child under the same fixture and test bindings. For a volatile delegation,
supply a test callback which calls ExAgent.run_child/4.