Expand description
A2A v1.0 conformance vector runner.
The spec publishes a set of request/response examples; this
module is the loop that drives each one through an
A2aRequestHandler and reports the diff. The handler can
be the library’s own reference implementation, a third-party
server a consumer is auditing, or a fixture for a test.
§Vector format
A vector is a JSON object with name, request, and
expected:
{"name": "send-message-happy",
"request": {"jsonrpc": "2.0", "id": 1, "method": "SendMessage",
"params": {"message": {...}}},
"expected": {"result": {...}}}expected is one of {"result": <value>} for a successful
response or {"error": {"code": <i64>, "message_contains": <str>}}
for an error response. The message_contains form is the
forgiving one: a server is free to add detail, but a runner
that asserted the whole message verbatim would couple
vectors to a specific implementation’s wording.
Structs§
- Expected
Error - The expected error code and a substring the message must contain. The code is exact; the message is a substring match.
- Jsonl
Error - Why a JSONL fixture could not be parsed.
- Observed
Error - The shape of an observed error: the code
the server returned and the message it
carried. Compared against
ExpectedErrorwith==on the code and substring on the message. - Vector
- One conformance vector, exactly as it appears in a JSONL fixture file. The shape is a JSON object, one per line.
- Vector
Result - The outcome of running a single vector. A
ConformanceReportis aVec<VectorResult>.
Enums§
- Expected
Response - What the server is expected to answer. One of
Result(a successful response) orError(a JSON-RPC error with the code and a substring the message must contain). - Observed
Response - What the runner actually saw on the wire, in
the same shape the fixture uses for
expected. - Vector
Outcome - What the runner saw when it ran a vector.
Constants§
- DEFAULT_
PROTOCOL_ VERSION - The default protocol version the runner uses when the caller does not specify one. A2A’s 1.0.1 is a patch (no schema changes), so 1.0 is the right default for vectors that pin the spec’s behaviour.
Functions§
- parse_
jsonl - Parses a JSONL fixture file’s contents into a list of vectors.
- run_
against_ in_ process - Runs a list of vectors against a handler, using
the in-process
serve_jsonrpcadapter. - run_one
- Runs a single vector through the supplied router.