A2A Registry API Reference¶
Overview¶
The A2A Registry provides a multi-protocol API for agent registration, discovery, and management. This reference covers the primary interaction methods across JSON-RPC 2.0, REST, and GraphQL protocols.
Authentication & Security¶
Trust Levels¶
- Development Mode: Open access, for local development
- Production Mode: Strict authentication and authorization
- JWT-based authentication
- Role-based access control (RBAC)
- Configurable trust levels for agent registration
Authentication Methods¶
- JWT Token
- API Key
- OAuth 2.0
Core API Methods¶
Agent Registration¶
JSON-RPC 2.0¶
{
"jsonrpc": "2.0",
"method": "register_agent",
"params": {
"agent_card": {
"name": "example-agent",
"description": "Agent description",
"version": "1.0.0",
"protocol_version": "0.3.0",
"preferred_transport": "JSONRPC",
"skills": [
{
"id": "skill_id",
"description": "Skill description"
}
]
}
},
"id": 1
}
REST Endpoint¶
GraphQL Mutation¶
mutation {
registerAgent(
agentCard: {
name: "example-agent"
# ... other fields
}
) {
id
name
registrationTimestamp
}
}
Agent Discovery¶
Search Methods¶
- By skill
- By name/description
- By trust level
- By protocol version
JSON-RPC 2.0 Search¶
{
"jsonrpc": "2.0",
"method": "search_agents",
"params": {
"skills": ["weather_forecast"],
"protocol_version": "0.3.0"
},
"id": 2
}
GraphQL Query¶
query {
searchAgents(
skills: ["weather_forecast"]
protocolVersion: "0.3.0"
) {
agents {
name
skills {
id
description
}
}
}
}
Auto-Generated Module Documentation¶
Server Module¶
A2A Registry server using FastAPI and FastA2A schemas with dual transport support.
GRAPHQL_AVAILABLE = False
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
RegisterAgentRequest
¶
create_app()
¶
Create FastAPI application for A2A Registry.
Source code in src/a2a_registry/server.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
Storage Module¶
Storage module for A2A Registry.
logger = logging.getLogger(__name__)
module-attribute
¶
storage = get_vector_enhanced_storage()
module-attribute
¶
ExtensionInfo(uri, description='', required=False, params=None, first_declared_by_agent='', first_declared_at=None, trust_level='TRUST_LEVEL_UNVERIFIED')
¶
Information about an agent extension with provenance tracking.
Source code in src/a2a_registry/storage.py
declaring_agents = set()
instance-attribute
¶
description = description
instance-attribute
¶
first_declared_at = first_declared_at or datetime.now(UTC)
instance-attribute
¶
first_declared_by_agent = first_declared_by_agent
instance-attribute
¶
params = params or {}
instance-attribute
¶
required = required
instance-attribute
¶
trust_level = trust_level
instance-attribute
¶
uri = uri
instance-attribute
¶
usage_count
property
¶
Number of agents using this extension.
add_declaring_agent(agent_id)
¶
from_dict(data)
classmethod
¶
Create from dictionary representation.
Source code in src/a2a_registry/storage.py
remove_declaring_agent(agent_id)
¶
to_dict()
¶
Convert to dictionary representation.
Source code in src/a2a_registry/storage.py
FileStorage(data_dir='/data')
¶
Bases: StorageBackend
File-based persistent storage for agent registry.
Source code in src/a2a_registry/storage.py
agents_file = self.data_dir / 'agents.json'
instance-attribute
¶
data_dir = Path(data_dir)
instance-attribute
¶
extensions_file = self.data_dir / 'extensions.json'
instance-attribute
¶
get_agent(agent_id)
async
¶
get_agent_extensions(agent_id)
async
¶
Get all extensions used by a specific agent.
get_extension(uri)
async
¶
list_agents()
async
¶
list_extensions(uri_pattern=None, declaring_agents=None, trust_levels=None, page_size=100, page_token=None)
async
¶
List extensions with optional filtering and pagination.
Source code in src/a2a_registry/storage.py
register_agent(agent_card)
async
¶
Register an agent in the registry.
Source code in src/a2a_registry/storage.py
remove_agent_from_extensions(agent_id)
async
¶
Remove agent from all extension declarations.
Source code in src/a2a_registry/storage.py
search_agents(query)
async
¶
Search agents by name, description, or capabilities.
Source code in src/a2a_registry/storage.py
store_extension(extension_info)
async
¶
Store extension information.
Source code in src/a2a_registry/storage.py
unregister_agent(agent_id)
async
¶
Unregister an agent.
Source code in src/a2a_registry/storage.py
update_agent_extensions(agent_id, extensions)
async
¶
Update extensions for an agent.
Source code in src/a2a_registry/storage.py
InMemoryStorage()
¶
Bases: StorageBackend
In-memory storage for agent registry.
Source code in src/a2a_registry/storage.py
get_agent(agent_id)
async
¶
get_agent_extensions(agent_id)
async
¶
Get all extensions used by a specific agent.
get_extension(uri)
async
¶
list_agents()
async
¶
list_extensions(uri_pattern=None, declaring_agents=None, trust_levels=None, page_size=100, page_token=None)
async
¶
List extensions with optional filtering and pagination.
Source code in src/a2a_registry/storage.py
register_agent(agent_card)
async
¶
Register an agent in the registry.
Source code in src/a2a_registry/storage.py
remove_agent_from_extensions(agent_id)
async
¶
Remove agent from all extension declarations.
Source code in src/a2a_registry/storage.py
search_agents(query)
async
¶
Search agents by name, description, or capabilities.
Source code in src/a2a_registry/storage.py
store_extension(extension_info)
async
¶
Store extension information.
unregister_agent(agent_id)
async
¶
Unregister an agent.
update_agent_extensions(agent_id, extensions)
async
¶
Update extensions for an agent.
Source code in src/a2a_registry/storage.py
StorageBackend
¶
Bases: ABC
Abstract base class for storage backends.
get_agent(agent_id)
abstractmethod
async
¶
get_agent_extensions(agent_id)
abstractmethod
async
¶
get_extension(uri)
abstractmethod
async
¶
list_agents()
abstractmethod
async
¶
list_extensions(uri_pattern=None, declaring_agents=None, trust_levels=None, page_size=100, page_token=None)
abstractmethod
async
¶
List extensions with optional filtering and pagination.
Source code in src/a2a_registry/storage.py
register_agent(agent_card)
abstractmethod
async
¶
remove_agent_from_extensions(agent_id)
abstractmethod
async
¶
search_agents(query)
abstractmethod
async
¶
store_extension(extension_info)
abstractmethod
async
¶
unregister_agent(agent_id)
abstractmethod
async
¶
update_agent_extensions(agent_id, extensions)
abstractmethod
async
¶
get_storage_backend()
¶
Get the appropriate storage backend based on environment configuration.
Source code in src/a2a_registry/storage.py
get_vector_enhanced_storage()
¶
Get vector-enhanced storage wrapper.
Source code in src/a2a_registry/storage.py
CLI Module¶
Command line interface for a2a-registry.
cli()
¶
main()
¶
serve(host, port, reload)
¶
Start the A2A Registry JSON-RPC server.
Source code in src/a2a_registry/cli.py
Extension System¶
URI Allowlist¶
- Configurable whitelist for agent extension URIs
- Trust level assignment for extensions
- Granular access control
Extension Registration¶
# Example extension registration
extension = {
"uri": "https://example.com/agent-extension",
"trust_level": "high",
"allowed_skills": ["weather", "forecast"]
}
registry.register_extension(extension)
Error Handling¶
Common Error Codes¶
AGENT_REGISTRATION_FAILED
(1001)AGENT_NOT_FOUND
(1002)UNAUTHORIZED_ACCESS
(1003)INVALID_PROTOCOL_VERSION
(1004)
Error Response Example¶
{
"error": {
"code": 1001,
"message": "Agent registration failed",
"details": {
"reason": "Invalid agent card format"
}
}
}
Performance & Rate Limiting¶
- Default rate limit: 100 requests/minute
- Configurable per API key
- Supports exponential backoff
Monitoring & Health Checks¶
Agent Health Endpoints¶
/health
: Overall system health/agents/health
: Aggregate agent health/metrics
: Prometheus-compatible metrics
Configuration Options¶
# Example configuration
registry_config = {
"host": "0.0.0.0",
"port": 8000,
"log_level": "INFO",
"auth_mode": "production",
"trust_levels": {
"development": {"max_agents": 10},
"production": {"max_agents": 1000}
}
}
Compatibility¶
- A2A Protocol: v0.3.0
- Python: 3.9+
- Supported Transports:
- JSON-RPC 2.0 (Primary)
- REST
- GraphQL
- gRPC (Experimental)
Best Practices¶
- Use JWT for authentication in production
- Implement agent health checks
- Validate agent cards before registration
- Use GraphQL for complex querying
- Implement proper error handling
SDK & Client Libraries¶
- Official Python SDK
- Community-supported libraries for other languages
Troubleshooting¶
Common Issues¶
- Incorrect agent card format
- Authentication failures
- Protocol version mismatches
Refer to our Troubleshooting Guide for detailed resolution steps.