Skip to main content

Module send_message

Module send_message 

Source
Expand description

A2A SendMessage typed envelopes — the request, the configuration, and the response.

§What these are

SendMessageRequest is the typed shape of the params field for the SendMessage JSON-RPC method. SendMessageResponse is the typed shape of the result field — either a Task (the work is in progress or complete) or a Message (the agent answered directly without creating a task).

The handler that implements A2aRequestHandler decodes the raw serde_json::Value params into a SendMessageRequest and serialises the result back as a SendMessageResponse. The serving adapter (serve_jsonrpc) handles the JSON-RPC envelope; the handler is responsible only for the method-specific decoding.

§Why an untagged enum for the response

The wire form of a SendMessage response is the inner object directly: a Task is {"id": "...", "status": ...}, a Message is {"role": ..., "parts": ...}. The two shapes are discriminated by which top-level field is present (id for Task, role for Message). An untagged enum matches the wire form; a tagged enum ({"kind": "task", "task": {...}}) would add a key the spec does not name.

§Why accepted_output_modes is BTreeSet

and not Vec

The accepted_output_modes list is a set of MIME types the client can accept; a duplicate is a wire bug. The Rust type that surfaces a duplicate is a BTreeSet (ordered, so the wire form is deterministic; set, so duplicates fail at the type level). The trade-off is losing the order the client sent — which the spec does not require preserving.

Structs§

MessageSendConfiguration
Configuration for a SendMessage request.
SendMessageRequest
A typed SendMessage request. Wire form:

Enums§

SendMessageResponse
A typed SendMessage response.