Quick Start
How It Works
| Component | Security Level | Purpose |
|---|---|---|
| Discovery Endpoint | Public | Agent card per A2A spec |
| A2A Endpoint | Protected | Authenticated communication |
| Status Endpoint | Public | Health checks |
Security Configurations
Bearer Token Authentication
The simplest authentication method using a shared secret:Client Example
Extended Agent Card
When authentication is enabled, the agent card can indicate security requirements:Common Patterns
Environment-Based Tokens
FastAPI Integration
Multi-Environment Setup
Best Practices
Token Security
Token Security
- Use cryptographically secure random tokens (32+ characters)
- Store tokens in environment variables, never in code
- Rotate tokens regularly in production environments
- Use different tokens for different environments
- Consider using prefixes like
sk-prod-,sk-dev-for identification
Discovery Compliance
Discovery Compliance
- Keep
/.well-known/agent.jsonpublic per A2A specification - Only protect the
/a2aendpoint with authentication - Ensure agent cards don’t expose sensitive information
- Status endpoints can remain public for health checks
Error Handling
Error Handling
- Return standard HTTP 401 for invalid/missing tokens
- Use consistent error message format
- Log authentication attempts for monitoring
- Implement rate limiting for failed authentication attempts
Production Deployment
Production Deployment
- Use HTTPS in production environments
- Implement proper logging and monitoring
- Consider API gateways for additional security layers
- Set up proper CORS policies for web clients
- Monitor token usage patterns for anomalies
Related
A2A Protocol
Learn the A2A protocol basics and setup
Agent API
RESTful API endpoints for agent services

