Skip to main content

Overview

Agent cards are JSON documents that describe an A2A agent’s capabilities, skills, and authentication requirements. They follow the A2A Protocol specification and are discovered at the well-known path:
{agent_url}/.well-known/a2a/agent.json
Handler provides tools for fetching, validating, and inspecting agent cards.

Agent Card Structure

A typical agent card includes:
agent.json
{
  "name": "Example Agent",
  "description": "An example A2A agent",
  "protocolVersion": "0.3.0",
  "capabilities": {
    "streaming": true,
    "pushNotifications": false
  },
  "skills": [
    {
      "id": "weather",
      "name": "Weather Information",
      "description": "Get current weather and forecasts"
    }
  ],
  "supportedContentTypes": [
    "text/plain",
    "application/json"
  ],
  "authenticationRequirements": [
    {
      "type": "bearer",
      "description": "API authentication via bearer token"
    }
  ],
  "transports": [
    {
      "protocol": "jsonrpc",
      "url": "http://localhost:8000/a2a/v1/"
    }
  ]
}

Fetching Agent Cards

Fetch and display an agent card:
handler card get http://localhost:8000
Output includes:
  • Agent name and description
  • Protocol version
  • Capabilities (streaming, push notifications)
  • Skills list
  • Supported content types
  • Authentication requirements
  • Transport endpoints

Validating Agent Cards

Handler validates agent cards against the A2A protocol specification using Pydantic models.
handler card validate http://localhost:8000
Success output:
Agent Card Validation
Status: Valid
Agent: Example Agent
Protocol Version: 0.3.0

Capabilities:
  Streaming: Yes
  Push Notifications: No

Skills: 2
  - weather: Weather Information
  - calculator: Basic calculations
Error output:
Agent Card Validation
Status: Invalid
Source: http://localhost:8000

Issues:
  - protocolVersion: Field required
  - capabilities.streaming: Input should be a valid boolean

Validation Result Structure

Validation results include detailed information:
@dataclass
class ValidationResult:
    """Result of validating an agent card."""
    
    valid: bool
    source: str
    source_type: ValidationSource
    agent_card: AgentCard | None = None
    issues: list[ValidationIssue] = field(default_factory=list)
    raw_data: dict[str, Any] | None = None
    
    @property
    def agent_name(self) -> str:
        """Get the agent name if available."""
        if self.agent_card:
            return self.agent_card.name
        if self.raw_data:
            return self.raw_data.get("name", "Unknown")
        return "Unknown"
    
    @property
    def protocol_version(self) -> str:
        """Get the protocol version if available."""
        if self.agent_card:
            return self.agent_card.protocol_version or "Unknown"
        if self.raw_data:
            return self.raw_data.get("protocolVersion", "Unknown")
        return "Unknown"

Understanding Capabilities

Agent cards declare capabilities that affect how you interact with them:
Indicates whether the agent supports streaming responses:
{
  "capabilities": {
    "streaming": true
  }
}
Check in code:
service.py:307-312
@property
def supports_streaming(self) -> bool:
    """Check if the agent supports streaming."""
    if self._cached_agent_card and self._cached_agent_card.capabilities:
        return bool(self._cached_agent_card.capabilities.streaming)
    return False
If supported, use streaming endpoints for real-time responses:
handler message stream --url http://localhost:8000 "Hello!"

Skills Discovery

Agent cards list available skills:
{
  "skills": [
    {
      "id": "weather",
      "name": "Weather Information",
      "description": "Get current weather and forecasts for any location"
    },
    {
      "id": "calculator",
      "name": "Calculator",
      "description": "Perform basic arithmetic operations"
    }
  ]
}
Skills help you understand what the agent can do before interacting.

Authentication Requirements

Agent cards specify required authentication:
{
  "authenticationRequirements": [
    {
      "type": "bearer",
      "description": "API authentication via bearer token"
    }
  ]
}
Common types:
  • bearer: Bearer token in Authorization header
  • api_key: API key in custom header
  • oauth2: OAuth 2.0 flow
  • none: No authentication required
See Authentication Guide for setup.

Transport Endpoints

Cards declare protocol endpoints:
{
  "transports": [
    {
      "protocol": "jsonrpc",
      "url": "http://localhost:8000/a2a/v1/"
    },
    {
      "protocol": "grpc",
      "url": "grpc://localhost:50051"
    }
  ]
}
Handler currently supports jsonrpc transport.

Common Validation Issues

Error:
Field required: protocolVersion
Fix: Add the missing field:
{
  "protocolVersion": "0.3.0"
}
Error:
capabilities.streaming: Input should be a valid boolean
Fix: Use boolean values:
{
  "capabilities": {
    "streaming": true,  // not "true" or 1
    "pushNotifications": false
  }
}
Error:
Invalid JSON at line 5, column 3: Expecting ',' delimiter
Fix: Check JSON syntax:
jq . agent.json
Error:
Connection error: [Errno 111] Connection refused
Fix: Ensure agent server is running:
# Check if agent is responding
curl http://localhost:8000/.well-known/a2a/agent.json

Creating Valid Agent Cards

When building your own agent:
1

Start with a template

agent.json
{
  "name": "My Agent",
  "description": "A brief description",
  "protocolVersion": "0.3.0",
  "capabilities": {
    "streaming": true,
    "pushNotifications": false
  },
  "skills": [],
  "supportedContentTypes": ["text/plain"],
  "transports": [
    {
      "protocol": "jsonrpc",
      "url": "http://localhost:8000/a2a/v1/"
    }
  ]
}
2

Validate locally

handler card validate --file agent.json
3

Serve at well-known path

Ensure your agent serves the card at:
/.well-known/a2a/agent.json
4

Validate from URL

handler card validate http://localhost:8000

Protocol Versions

Handler supports A2A protocol version 0.3.0. Check compatibility:
handler --version
# a2a-handler 0.1.0 (A2A Protocol 0.3.0)
If an agent uses a different protocol version, validation may report compatibility warnings.

Best Practices

Validate Early

Validate agent cards during development, not in production.

Document Skills

Provide clear skill descriptions so clients understand capabilities.

Specify Content Types

List all supported content types in supportedContentTypes.

Update Protocol Version

Keep protocolVersion current with your implementation.

Next Steps