What Is an Agent Gateway?

An agent gateway governs AI agent traffic over A2A, MCP and model APIs. Learn how it works, what it controls and how it differs from an AI gateway

10 min read

What Is an Agent Gateway? How It Works | Bifrost

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:

  1. 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.
  2. 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.
  3. Authorization. The gateway checks whether that identity may call this agent. Deployments that deny by default reject any agent without an explicit grant.
  4. Routing. The gateway selects one of the agent's advertised interfaces, attaches the agent's own credential and forwards the task.
  5. Egress. While working, the agent calls models and MCP tools back through the gateway, carrying the caller's identity and the task ID.
  6. Recording. Each hop is logged and traced under the same task.

A caller sends an A2A task through an agent gateway that authenticates, authorizes, routes and records it; the agent's own model and tool calls return through the same gateway

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.

FunctionWhat the gateway doesTypical mechanism
AuthenticationVerifies the caller and the agentAPI keys, OAuth 2.0 tokens, mutual TLS, workload identities such as SPIFFE IDs
Credential brokeringHolds upstream credentials so agents never store long-lived secretsOAuth client credentials, token exchange, per-user OAuth
GovernanceGrants each identity specific agents, tools and modelsAllow lists per key or team; deny by default
Routing and load balancingPicks an endpoint and fails over when one is downAgent Card interface order, URL paths, the A2A tenant field
Rate limiting and costCaps requests, tokens and spend per callerRequest and token limits, budgets
GuardrailsScreens prompts, tool results and artifactsPrompt injection and sensitive-data detection
ObservabilityLogs and traces each hop with shared IDsOpenTelemetry 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.

DimensionAPI gatewayAI gateway (LLM gateway)MCP gatewayAgent gateway
Traffic governedClient to backend serviceApplication to model providerAgent to tool serverAgent to agent, plus tool and model calls
Unit of workHTTP requestCompletion or embedding calltools/call requestTask with a lifecycle, context ID and artifacts
Protocol awarenessHTTP, gRPCOpenAI-compatible model APIsMCP over stdio or Streamable HTTPA2A, MCP and model APIs
Typical policyAuth, quotas, routingProvider keys, budgets, failoverTool filtering, per-user tool authAgent grants, credential forwarding, task tracing
Identity problemOne caller per requestOne caller per requestCaller and tool accountCaller 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.

  1. Register every agent and tool server. Record each Agent Card URL and MCP server so the gateway knows what exists.
  2. 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.
  3. Deny by default. Grant agents, tools and models per caller, and enforce authentication so anonymous requests fail.
  4. Propagate IDs. Carry the A2A context ID and task ID, plus W3C traceparent, on every model and tool call.
  5. Set retry rules per failure type. Retry unreached endpoints, never replay ambiguous failures, and reattach to streams by task ID.
  6. 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.

Three failure types branch to three outcomes: an unreached endpoint tries the next interface, an ambiguous failure returns the error without replay, an interrupted stream is reattached by task ID

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

[ Keep reading ]

More on AI Agent

View all →