a2a-types
Pure Rust implementation of the Agent-to-Agent (A2A) Protocol types.
Overview
This crate provides the complete type definitions for the A2A Protocol, enabling interoperability between AI agents. It includes:
- JSON-RPC 2.0 message types
- A2A protocol-specific types (Tasks, Messages, Parts)
- Error definitions
- Request/Response structures
Usage
Add this to your Cargo.toml:
[]
= "0.0.2"
Then use the types in your code:
use ;
// Create a new message
let message = Message ;
// Work with task states
let state = Working;
Types
Core Protocol Types
Task- Represents an agent task with status and historyMessage- Agent communication messagesPart- Content parts (text, file, data)TaskState- Task lifecycle states (Submitted, Working, Completed, etc.)
JSON-RPC Types
JSONRPCRequest- Standard JSON-RPC 2.0 requestJSONRPCResponse- Success and error responsesJSONRPCError- Error structure with codes
A2A Request Types
SendMessageRequest- Send a message to an agentSendStreamingMessageRequest- Stream messagesGetTaskRequest- Retrieve task detailsCancelTaskRequest- Cancel a running task
License
Apache-2.0