package a2a-client
Module A2a_client_testingSource
A scripted A2A agent behind an A2a_client.Transport.t, for testing code that uses the client without a network.
Replies are given as typed values and encoded in the wire format of the agent's protocol version and binding (JSON-RPC envelopes with the request's id, REST bodies, SSE framing), so tests contain no hand-written JSON.
let agent =
A2a_client_testing.agent ~clock (fun _req ->
Reply.stream [ Step.event (Task task); Step.event (Status_update done_) ])
in
let client =
A2a_client.create ~clock ~transport:(A2a_client_testing.transport agent) endpoint
in
...Source
val agent :
?protocol:A2a_client.Protocol.t ->
clock:_ Eio.Time.Mono.t ->
(A2a_client.Transport.request -> Reply.t) ->
agentAn agent that answers each request with the handler's reply, in the wire format of protocol (default A2a_client.Protocol.default). Create the client with the same protocol.
The requests received so far, oldest first.
The JSON-RPC method of a request, e.g. "SendStreamingMessage" or "message/stream"; None for REST requests.
The JSON-RPC params, or the REST body; `Null if there is none.