The A2A protocol uses types from the a2a-sdk package for agent-to-agent communication. These types follow the A2A protocol v0.3.0 specification.
Core Types
JSONRPCRequest
Represents a JSON-RPC request in the A2A protocol.
from a2a.types import JSONRPCRequest
Fields:
id - Unique identifier for the request
method - The RPC method to call (e.g., “message/send”, “message/stream”)
params - Parameters for the method
jsonrpc - Protocol version (“2.0”)
JSONRPCResponse
Represents a JSON-RPC response.
from a2a.types import JSONRPCResponse
Fields:
id - Request identifier this response corresponds to
result - The result data (if successful)
error - Error information (if failed)
jsonrpc - Protocol version (“2.0”)
JSONRPCError
Represents an error in a JSON-RPC response.
from a2a.types import JSONRPCError
Fields:
code - Numeric error code
message - Human-readable error message
data - Additional error details (optional)
AgentCard
The agent card manifest that describes the agent’s capabilities.
from a2a.types import AgentCard
Fields:
name - Agent name
description - Agent description
url - Agent base URL
version - Agent version
skills - List of agent skills
capabilities - Supported capabilities
additionalInterfaces - Additional communication interfaces
securitySchemes - Authentication schemes
security - Security requirements
defaultInputModes - Default input content types
defaultOutputModes - Default output content types
supportsAuthenticatedExtendedCard - Whether extended card is supported
signatures - Cryptographic signatures
AgentSkill
Describes a specific skill or capability the agent can perform.
from a2a.types import AgentSkill
Fields:
name - Skill identifier
description - Skill description
tags - Categorization tags (optional)
examples - Usage examples (optional)
AgentCapabilities
Describes the technical capabilities supported by the agent.
from a2a.types import AgentCapabilities
Fields:
streaming - Whether the agent supports streaming responses
statefulness - Whether the agent maintains conversation state
asyncProcessing - Whether the agent supports asynchronous task processing
SendStreamingMessageRequest
A specialized request type for streaming messages.
from a2a.types import SendStreamingMessageRequest
Extends JSONRPCRequest with streaming-specific parameters.
Task
Represents an asynchronous task.
from a2a.types import Task
Fields:
id - Task identifier
status - Current task status
state - Task state information
created - Creation timestamp
updated - Last update timestamp
TaskState
Enum representing task state values.
from a2a.types import TaskState
Values:
pending - Task is queued
working - Task is in progress
completed - Task finished successfully
failed - Task encountered an error
cancelled - Task was cancelled
TaskStatus
Represents the current status details of a task.
from a2a.types import TaskStatus
Fields:
state - Current task state (TaskState)
progress - Progress percentage (0-100, optional)
message - Status message (optional)
from a2a.types import TaskState, TaskStatus
in_progress = TaskStatus(state=TaskState.working)
done = TaskStatus(state=TaskState.completed)
Usage Example
from a2a.types import (
AgentCard,
AgentCapabilities,
AgentSkill,
JSONRPCRequest,
JSONRPCResponse,
JSONRPCError,
)
# Create an agent card
card = AgentCard(
name="My Agent",
description="A helpful assistant",
url="http://localhost:8000",
version="1.0.0",
skills=[
AgentSkill(
name="search",
description="Search the web for information"
)
],
capabilities=AgentCapabilities(
streaming=True,
statefulness=True,
asyncProcessing=True
),
)
# Handle a JSON-RPC request
request = JSONRPCRequest(
id="123",
method="message/send",
params={"message": "Hello"},
jsonrpc="2.0"
)
# Create a response
response = JSONRPCResponse(
id=request.id,
result={"message": "Hello! How can I help?"},
jsonrpc="2.0"
)
Import Path
from a2a.types import (
AgentCapabilities,
AgentCard,
AgentSkill,
JSONRPCError,
JSONRPCRequest,
JSONRPCResponse,
SendStreamingMessageRequest,
Task,
TaskState,
TaskStatus,
)
Source: /home/daytona/workspace/source/src/agentor/a2a.py:4 Last modified on March 4, 2026