a2a-types
Rust types for the A2A v1.0 protocol, generated from the canonical a2a.proto definition vendored in this repository.
Source of truth
All types are generated at build time by prost and pbjson from proto/a2a.proto. There is no hand-written domain model — the proto file is the single source of truth for every field name, type, and serialization format.
Installation
[]
= "0.2.0"
Usage
Every generated type is available directly at the crate root — no sub-module prefix required.
use ;
let message = Message ;
let request = SendMessageRequest ;
What is included
| Category | Types |
|---|---|
| Core protocol | Task, TaskStatus, TaskState, Message, Part, Artifact, Role |
| Streaming events | TaskStatusUpdateEvent, TaskArtifactUpdateEvent, StreamResponse |
| Request / response | SendMessageRequest, SendMessageResponse, GetTaskRequest, ListTasksRequest, CancelTaskRequest, SubscribeToTaskRequest |
| Agent card | AgentCard, AgentCapabilities, AgentSkill, AgentInterface, AgentProvider |
| Security schemes | SecurityScheme, ApiKeySecurityScheme, HttpAuthSecurityScheme, OAuth2SecurityScheme, OAuthFlows, and all OAuth flow variants |
| JSON-RPC framing | JSONRPCId, JSONRPCError, JSONRPCErrorResponse (hand-written; JSON-RPC is not in the proto) |
| A2A error codes | InvalidRequestError, InvalidParamsError, InternalError, TaskNotFoundError, UnsupportedOperationError |
oneof payload variants live in sub-modules mirroring the proto structure:
use ;
// Construct a text part
let content = Text;
// Match a stream event
match response.payload
Version compatibility
| Crate version | A2A protocol version |
|---|---|
| 0.1.x | 1.0 — hand-written types, a2a_types::v1 namespace |
| 0.2.x | 1.0 — proto-generated types, flat a2a_types::* namespace |
License
MIT