Skip to content

apomesh-a2a-types

The shared A2A v1.0 wire vocabulary. Nearly every A2A shape is bidirectional — a Task the inbound server renders is the same Task the outbound client parses — so the vocabulary lives once, in this dependency-light crate (serde + serde_json only), and neither consumer pulls the other’s dependency tree. It was extracted from the inbound adapter’s private types.rs when the outbound leg landed; the adapter re-exports it, so its public surface is unchanged.

The wire shapes are pinned against the A2A v1.0 protocol (proto package lf.a2a.v1 and its rendered specification). The upstream proto is not vendored — it is third-party licensed — so the message and field names are the citation anchors, never the file.

  • Layer: protocol-adjacent vocabulary leaf — it sits beside the substrate, not inside it, exactly like the A2A adapter itself. See Agent federation for the two-way story it underpins.
  • Depends on: no workspace crates — serde + serde_json only. This leaf-ness is deliberate.
  • Consumed by: apomesh-a2a (the inbound server adapter, which re-exports it) and apomesh-a2a-client (the outbound agent-as-tool client).

Two surfaces:

  • The A2A domain model at the crate root — TaskState (with the is_terminal / is_interrupted / closes_stream classifiers), Role, Part / PartBody, Message, Artifact, TaskStatus, Task, ListTasksResponse, the streaming events (TaskStatusUpdateEvent, TaskArtifactUpdateEvent, StreamResponse, SendMessageResponse), and the agent-card family (AgentCard, AgentInterface, AgentProvider, AgentCapabilities, AgentSkill, SecurityScheme, OAuthFlows, …).
  • jsonrpc — the JSON-RPC 2.0 envelope vocabulary the A2A JSON-RPC binding rides: the typed JsonRpcRequest envelope, the client-side JsonRpcResponse classifier (into_result), and the error-code constants — the JSON-RPC set (PARSE_ERROR, INVALID_REQUEST, METHOD_NOT_FOUND, INVALID_PARAMS, INTERNAL_ERROR) plus the A2A-specific set (TASK_NOT_FOUND, PUSH_NOTIFICATION_NOT_SUPPORTED, UNSUPPORTED_OPERATION, …).

Also home to the protocol constants both directions share: JSONRPC_PROTOCOL_BINDING and APOMESH_API_KEY_HEADER (X-Apomesh-Api-Key, the header apomesh peers use for API-key auth).

The closed enums here follow the workspace’s wildcard-free discipline: the substrate↔A2A state projections on both sides are exhaustive matches with compile-time canaries, so a new upstream TaskState variant cannot land without both directions taking an explicit arm.

  • Reference: apomesh-a2a — the inbound server adapter (translate-and-delegate onto the substrate).
  • Reference: apomesh-a2a-client — the outbound client that drives a remote peer as a delegate tool.
  • Concepts: Agent federation — how the two directions compose.