What A2A is
The Agent-to-Agent (A2A) protocol is an open standard from Google that lets AI agents discover and communicate with each other. Where MCP handles the connection between agents and tools, A2A handles the connection between agents themselves. Think of it this way: MCP is how an agent uses a tool. A2A is how an agent talks to another agent. KavachOS implements A2A with built-in authentication, so every agent interaction is identity-verified and audited.A2A and MCP compared
Setup
Install
Create an A2A server
The A2A server exposes your agent as a JSON-RPC endpoint that other agents can call.A2A server config
A2AAgentCard
The Agent Card that describes this agent. Served at /.well-known/agent.json.
A2ATaskHandler
Callbacks for handling incoming messages, cancellations, and streaming.
Validates the caller. Return an agent/user ID or null to reject. Optional, omit to allow unauthenticated calls.
Called after each A2A interaction for audit logging.
A2ATaskStore
Custom task persistence. Defaults to an in-memory Map.
Agent Cards
An Agent Card is a JSON document that describes what an agent can do, how to authenticate with it, and where to reach it. Other agents fetch this card to decide whether and how to communicate.Creating a card
Validating a card
Signing and verifying
Agent Cards can be signed with a private key so that consumers can verify the card hasn’t been tampered with.Calling other agents
The A2A client discovers remote agents and sends them tasks.Retrieving and canceling tasks
Authentication between agents
KavachOS supports all A2A security schemes. You declare them in the Agent Card and enforce them in the server’sauthenticate callback.
- Bearer token
- API key
- OAuth 2.0
Task lifecycle
A2A tasks go through a defined state machine:onAudit callback is set, every interaction is logged with the method name, caller identity, task ID, and outcome.
A2A tasks are independent from MCP tool calls. An agent might use MCP to call tools internally while processing an A2A task, but the two protocols operate at different layers.