An agent gateway is a control layer that sits between AI agents and everything they call: other agents, tools and models. It authenticates each agent and its caller, decides which agents, MCP servers and model providers they may reach, routes requests across protocols such as A2A and the Model Context Protocol (MCP), and records every hop so one task can be traced end to end.
Agent traffic now has two open standards. Anthropic released MCP for tool access in November 2024, and Google's A2A protocol for agent-to-agent delegation reached v1.0 in March 2026. Each new agent adds endpoints, credentials and logs. Bifrost, the open-source AI gateway, governs agent, tool and model traffic through one gateway.
How does an agent gateway work?
An agent gateway works by putting one policy point on both directions of agent traffic. Requests into an agent (ingress) and the agent's calls to tools, models and other agents (egress) pass through the gateway, which checks identity and permissions, picks an endpoint, forwards the request and logs it with shared IDs.
A single delegated task runs through six steps:
- Discovery. The caller reads the gateway's copy of the agent's Agent Card, the A2A document listing its skills, endpoints and authentication, with endpoints rewritten to point at the gateway.
- Authentication. The caller presents an API key, OAuth 2.0 token or client certificate, and the gateway maps it to a user, team or application.
- Authorization. The gateway checks whether that identity may call this agent. Deployments that deny by default reject any agent without an explicit grant.
- Routing. The gateway selects one of the agent's advertised interfaces, attaches the agent's own credential and forwards the task.
- Egress. While working, the agent calls models and MCP tools back through the gateway, carrying the caller's identity and the task ID.
- Recording. Each hop is logged and traced under the same task.

Figure 1: Inbound tasks and the agent's outbound model and tool calls pass the same checks, so one log covers the whole job.
Google's Agent Gateway documentation calls the two directions Client-to-Agent and Agent-to-Anywhere. Covering only one leaves half the path unaudited.
What an agent gateway controls
An agent gateway controls who can reach an agent, what the agent can reach in turn, and how much of each resource it uses. That covers authentication, credential brokering, governance, routing and load balancing, rate limiting, guardrails and observability, applied the same way to every agent instead of in each agent's code.
| Function | What the gateway does | Typical mechanism |
|---|---|---|
| Authentication | Verifies the caller and the agent | API keys, OAuth 2.0 tokens, mutual TLS, workload identities such as SPIFFE IDs |
| Credential brokering | Holds upstream credentials so agents never store long-lived secrets | OAuth client credentials, token exchange, per-user OAuth |
| Governance | Grants each identity specific agents, tools and models | Allow lists per key or team; deny by default |
| Routing and load balancing | Picks an endpoint and fails over when one is down | Agent Card interface order, URL paths, the A2A tenant field |
| Rate limiting and cost | Caps requests, tokens and spend per caller | Request and token limits, budgets |
| Guardrails | Screens prompts, tool results and artifacts | Prompt injection and sensitive-data detection |
| Observability | Logs and traces each hop with shared IDs | OpenTelemetry spans, A2A context and task IDs |
Governance at this layer means policy is set once and enforced everywhere, a pattern the AI governance guide describes for model traffic. Credential brokering matters most for agents that act in SaaS tools: a shared admin token gives every agent the same access and hides who acted, as the cross-app access post explains.
Which protocols does an agent gateway handle?
An agent gateway handles three kinds of traffic: A2A for agent-to-agent delegation, MCP for agent-to-tool calls, and LLM APIs for model calls, usually in the OpenAI-compatible format. Each protocol exposes different fields to route and enforce on, so protocol awareness is what separates this layer from a generic proxy.
A2A traffic
For A2A, the gateway serves a rewritten Agent Card and accepts any of the three A2A bindings: JSON-RPC 2.0, gRPC and HTTP+JSON. The A2A multi-tenancy guide lists three ways to route many agents behind one endpoint: a URL sub-path per agent, the credential's claims, or the optional tenant field, which clients must echo from the Agent Card on every request. A2A vs MCP compares the two protocols field by field.
MCP traffic
For MCP, the gateway connects agents to tool servers and filters which tools each caller sees. The MCP 2026-07-28 revision made three changes that help gateways. It removed protocol sessions, so requests can spread across server replicas without sticky routing. It requires Mcp-Method and Mcp-Name headers on Streamable HTTP POSTs, so a gateway can apply tool-level policy without parsing the body. List results also carry a cacheScope telling intermediaries what they may cache. The MCP gateway page covers this layer in depth.
Model API traffic
For model calls, the gateway includes an LLM gateway: one API in front of many providers, with key management, failover and token accounting. Caller attribution on these calls is what makes cost per task measurable.
Agent gateway vs AI gateway, MCP gateway and API gateway
An agent gateway differs from an AI gateway in scope. An AI gateway, often called an LLM gateway, governs calls from applications to models; an agent gateway also governs agent-to-agent tasks and agent-to-tool calls, and ties them to the model calls they cause. An MCP gateway covers only tools, and an API gateway knows none of these protocols.
| Dimension | API gateway | AI gateway (LLM gateway) | MCP gateway | Agent gateway |
|---|---|---|---|---|
| Traffic governed | Client to backend service | Application to model provider | Agent to tool server | Agent to agent, plus tool and model calls |
| Unit of work | HTTP request | Completion or embedding call | tools/call request | Task with a lifecycle, context ID and artifacts |
| Protocol awareness | HTTP, gRPC | OpenAI-compatible model APIs | MCP over stdio or Streamable HTTP | A2A, MCP and model APIs |
| Typical policy | Auth, quotas, routing | Provider keys, budgets, failover | Tool filtering, per-user tool auth | Agent grants, credential forwarding, task tracing |
| Identity problem | One caller per request | One caller per request | Caller and tool account | Caller identity across several hops |
In practice these converge, because an agent's tasks generate model calls and tool calls alike. Agent gateway vs LLM gateway vs MCP gateway walks through the differences with examples.
Managed and self-hosted agent gateways
Agent gateways come in two deployment models: managed gateways built into a cloud agent platform, and self-hosted gateways that run in a team's own network across clouds and providers. The choice decides which agents the gateway sees and where request data is processed.
In Google Cloud, Agent Gateway is part of the Gemini Enterprise Agent Platform: it gives each agent a SPIFFE-based identity, checks an Agent Registry of approved agents and tools, and blocks every connection no IAM policy allows. Google lists it for Agent Runtime, Gemini Enterprise and GKE, with Cloud Run and cross-cloud clusters in limited preview. On AWS, Amazon Bedrock AgentCore Gateway converts APIs and Lambda functions into MCP tools, manages inbound and outbound authentication, and fronts other agents.
A self-hosted gateway runs in the team's VPC or on-premises, in front of agents wherever they run, and keeps task data inside that network.
Challenges of running an agent gateway
The hardest problems at this layer come from multi-hop work: identity, retries and state all cross several services. A gateway that treats each hop as an unrelated HTTP request loses the link between a task and its calls, and can duplicate work when it retries.
- Lost caller identity. When agent A calls agent B, which calls a tool, the tool sees only agent B's service credential unless each hop forwards the original caller. Audit logs then name a shared account.
- Duplicate tasks from retries. A request that failed after the agent started work cannot be safely replayed; a retry may create a second task. Only failures where the agent never received the request are safe to retry.
- Card signatures. A gateway that rewrites an Agent Card's endpoints invalidates its signature, so clients must trust the gateway's card.
- State split across interfaces. An agent that serves JSON-RPC and gRPC must share task state, or a task created on one interface is missing on the other.
- Anonymous pass-through. Grants restrict identified callers; without enforced authentication, anonymous requests can still get through.
- Untrusted content. Remote agents' artifacts and tool results become model input, a prompt injection path covered in MCP security.
How to implement an agent gateway
Implementation starts with an inventory and an identity model, then adds policy, tracing and failure rules, in that order, because access rules cannot name agents nobody has registered.
- Register every agent and tool server. Record each Agent Card URL and MCP server so the gateway knows what exists.
- Choose how identity travels. Forward the caller's credential on each hop, or exchange it for a scoped token; avoid shared service accounts. MCP authentication compares the options for tools.
- Deny by default. Grant agents, tools and models per caller, and enforce authentication so anonymous requests fail.
- Propagate IDs. Carry the A2A context ID and task ID, plus W3C
traceparent, on every model and tool call. - Set retry rules per failure type. Retry unreached endpoints, never replay ambiguous failures, and reattach to streams by task ID.
- Decide what content is captured. Full prompts and artifacts help debugging but store sensitive data.
Agent gateway with Bifrost
Bifrost, the open-source AI gateway built by Maxim AI, governs model, MCP and agent traffic as one gateway, so teams do not run a separate agent gateway. The Agent Gateway in Bifrost currently supports A2A: a team registers an agent by its Agent Card URL, and Bifrost fetches the current card on each discovery request and rewrites its endpoints and authentication for callers.
Clients reach Bifrost over JSON-RPC, REST or gRPC, and Bifrost calls the agent over whichever interface its card lists first, so the two transports can differ. Agent access grants individual agents to virtual keys, separately from model and tool permissions, and enforce_auth_on_inference rejects anonymous calls.
With credential forwarding, the agent reuses the caller's credential on its own model and MCP calls and sends x-bf-session-id with the A2A context ID and x-bf-agent-correlation-id with the task ID. Agent Logs then link each task to those calls.
On the tool side, tool filtering limits which MCP tools each virtual key can call.

Figure 2: Bifrost retries only when the agent never received the request, because replaying started work could create a second task.
Transport selection and recovery follows the rule in Figure 2, and Bifrost never replays a stream. The same deployment routes to 10,000+ models across 25+ providers with 11 microseconds of overhead at 5,000 RPS.
The Agent Gateway announcement traces one task end to end.
To put your first agent behind Bifrost, start with the gateway quickstart, then register the agent and send it a task.
Frequently asked questions
What are the key differences between an AI gateway and an agent gateway?
An AI gateway governs calls from applications to model providers: keys, budgets, failover and token logs. An agent gateway adds agent-to-agent traffic over A2A and agent-to-tool traffic over MCP, and links each task to the model calls it triggers. Most include AI gateway functions, because every agent also calls models.
What is a GCP agent gateway?
A GCP agent gateway is Google Cloud's Agent Gateway, part of the Gemini Enterprise Agent Platform. It governs inbound traffic to agents and outbound traffic to tools, MCP servers, APIs and other agents, using SPIFFE-based agent identities, an Agent Registry and IAM policies that block connections by default. It supports MCP, A2A, REST and gRPC.
What is AgentCore Gateway?
AgentCore Gateway, formally Amazon Bedrock AgentCore Gateway, is the managed gateway in AWS's AgentCore agent platform. It converts APIs, Lambda functions and existing services into MCP-compatible tools, handles inbound authentication of agents and outbound authentication to tools, including OAuth token refresh, and can front other agents for A2A traffic.
Is an agent gateway the same as an MCP gateway?
No. An MCP gateway governs one connection type, from agents to MCP tool servers, with tool filtering and per-user tool credentials. An agent gateway also governs agent-to-agent tasks and the model calls agents make, and keeps the caller's identity across those hops. Many products combine both roles in one deployment.
Do you need an agent gateway for a single agent?
Usually not at first. One agent with one caller can hold its own credentials and logs. A gateway pays off once several teams call several agents, agents call each other, or an audit must show who triggered a tool call, because one shared policy point is simpler than per-agent controls.
- a2a
- agent gateway
- ai agent



