package a2a-client

  1. Overview
  2. Docs

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
  ...
Sourcemodule Step : sig ... end

One step of a streamed response.

Sourcemodule Reply : sig ... end

How the agent answers one request.

Sourcetype agent

An 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.

Sourceval rpc_method : A2a_client.Transport.request -> string option

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.