How A2A proxying works
Unlike MCP, an A2A backend is a plain HTTP host — any A2A-compatible agent server. Thea2a policy on a route tells Agentgateway to treat traffic on that route as A2A and process it accordingly.
When A2A mode is active, the gateway:
- Rewrites the agent card at
/.well-known/agent.jsonso theurlfield points back to the gateway, preventing clients from bypassing it on subsequent requests - Extracts the A2A method (
message/send,message/stream, etc.) from each request and adds it to structured logs asa2a.method - Applies all standard gateway policies (CORS, authentication, authorization, rate limiting) to A2A traffic
Configuration
Here is the complete configuration fromexamples/a2a/config.yaml:
config.yaml
a2a: {} in the route’s policies block. The backend is a host reference — the address of your upstream A2A agent server.
Running the example
Clone and start the sample A2A agent
The A2A samples project provides a reference agent implementation you can use for testing.This starts the agent on
localhost:9999.Start Agentgateway
In a separate terminal, run the gateway with the A2A example config:The gateway listens on port 3000 and proxies A2A traffic to
localhost:9999.Agent card rewriting
The A2A protocol uses an agent card at/.well-known/agent.json to advertise an agent’s capabilities and endpoint URL. When Agentgateway proxies A2A traffic, it rewrites the url field in the agent card to point back to the gateway.
This ensures that clients always route future requests through the gateway, rather than connecting directly to the upstream agent.
For example, fetch the agent card through the gateway:
url has been rewritten from localhost:9999 to localhost:3000 — the gateway’s address.
A2A telemetry
When A2A mode is active, Agentgateway adds thea2a.method field to structured access logs. This captures the A2A JSON-RPC method for each request, making it easy to filter and analyze agent communication patterns.
Example log line from a streaming message exchange:
a2a.method field identifies the specific A2A operation — in this case, message/stream.