AgentCore Gateway: one endpoint for tools, agents and models
Amazon Bedrock AgentCore Gateway puts an agent's tools, the other agents it calls and the models it uses behind one authenticated endpoint. It turns APIs and Lambda functions into one MCP server, proxies A2A agents, and routes model calls by the model name, with fallback to another provider since 22 October 2026. How each part works, the routing trap to avoid, rate limits, and what it costs.
Tecyfy · Published · 9 min read

Amazon Bedrock AgentCore Gateway is one authenticated endpoint for everything an AI agent calls: its tools, the other agents it hands work to, and the models it thinks with. Behind that endpoint it turns your APIs and Lambda functions into a single MCP server, forwards traffic to other agents, and sends each model request to Amazon Bedrock, OpenAI or Anthropic depending on the model name. Since 22 October 2026, in every Region with Gateway except those in China, it can also move a failed model request to another provider on its own.
It is one service of Amazon Bedrock AgentCore, and it works without the others: the agent can run on AgentCore Runtime, on Lambda, in a container or on a laptop.
3 kinds of target, and they behave differently
A gateway has targets, the backends it reaches, and every target falls into one of 3 groups. Which group decides how clients address it and what the gateway does to the traffic.
| MCP targets | HTTP targets | Inference targets | |
|---|---|---|---|
| What sits behind | Lambda functions, API Gateway stages, OpenAPI and Smithy APIs, remote MCP servers, built-in connectors (Salesforce, Slack, Jira, Zendesk and more) | AgentCore Runtime agents, A2A agents, external MCP servers, any HTTPS service | Amazon Bedrock, OpenAI, Anthropic, OpenAI-compatible endpoints |
| What the gateway does | Merges them into one MCP server and translates MCP calls into API or Lambda calls | Forwards requests as they are, no translation | Picks the provider from the model field and injects its key |
| How a client reaches it | /mcp, one tools/list for all | /{targetName}/{path} | /inference/... with the OpenAI, Anthropic or Bedrock SDK |
| Semantic tool search | Yes | No | No |
The default limits are generous: 100 targets per gateway, 1,000 tools per target, and 15 minutes for a single invocation, all adjustable.
Tools: many APIs become one MCP server
For MCP targets the gateway is an MCPModel Context ProtocolAn open standard for connecting AI applications to tools and data. A system offered once as an MCP server works in any application that speaks MCP. server whose tool list is the sum of every target's tools. The agent connects once and sees them all, each renamed as targetName___toolName with 3 underscores: a tool get_order behind a target called orders is orders___get_order to the agent. Code that routes on tool names, such as a Lambda handler serving several tools, has to strip the prefix.
Hundreds of tools in one list is its own problem, because every tool description costs tokens in every request and makes the model's choice harder. In the Regions that support it, turn on semantic search when you create the gateway and the agent can call a built-in tool, x_amz_bedrock_agentcore_search, with a sentence describing the task, and get back only the tools that fit. Our piece on MCP tool bloat explains why that matters for accuracy as well as cost.
A remote MCP server can be a target too. The gateway synchronizes its tools, prompts and resources, and with MCP sessions and response streaming turned on it passes through progress messages, elicitation (the server asking the user a question mid-call) and sampling (the server asking the client's model for a completion).
Models: the model name picks the provider
For inference, point the SDK you already use at the gateway instead of the provider. The gateway authenticates the caller, then calls the provider with the key it holds, so no agent ever sees an OpenAI or Anthropic key.
from openai import OpenAI
import anthropic
GATEWAY = "https://<gateway-id>.gateway.bedrock-agentcore.us-west-2.amazonaws.com"
openai_client = OpenAI(base_url=f"{GATEWAY}/inference/v1", api_key="<gateway token>")
reply = openai_client.chat.completions.create(
model="openai/gpt-5.5", # prefix = target name: always the openai target
messages=[{"role": "user", "content": "Summarise ticket 4182"}],
)
claude = anthropic.Anthropic(base_url=f"{GATEWAY}/inference", api_key="<gateway token>")
answer = claude.messages.create(
model="anthropic/claude-sonnet-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Draft the reply"}],
)
The gateway translates between the Bedrock, OpenAI and Anthropic request formats, so a client written for one can reach a provider that speaks another. Since 22 October the Bedrock InvokeModel and InvokeModelWithResponseStream APIs work through it too, so existing Bedrock code needs only a new endpoint. GET /inference/v1/models lists every model on every target.
The routing trap: an unprefixed name can land anywhere
A model name without a prefix, such as gpt-5.5, is matched against every inference target. If one matches, it goes there. If several match equally, the gateway prefers the Bedrock target when there is one; otherwise it picks one at random on each request. With an OpenAI target and an OpenAI-compatible proxy both serving the same name, identical requests can go to different providers, with different prices, data terms and rate limits.
Two fixes: prefix the model with the target name, as in the code above, or write a gateway rule that pins the model to a target. Rules are also how you run a canary or an A/B test: each has a priority from 1 to 1,000,000, lowest first, and can match on the model, the caller's IAM principal or the request path. The general idea is on our model routingModel RoutingSending each request to the cheapest model that handles it well, by rules, a classifier or a cascade, and checking with an eval that quality holds. page, and choosing which model gets which request covers the cost side.
Fallback: when the provider says no
Model fallback, added on 22 October, keeps an agent answering when a provider throttles it, runs out of capacity or stops responding. You add a fallback block to a rule's route: up to 2 more destinations, each a target and optionally a different model, and the conditions that make the gateway move on.
aws bedrock-agentcore-control create-gateway-rule \
--gateway-identifier my-gateway-abc1234567 \
--priority 100 \
--conditions '[{"matchModels": {"anyOf": [{"value": "gpt-5.5"}]}}]' \
--actions '[{"routeToTarget": {"staticRoute": {
"targetName": "bedrock-mantle", "model": "gpt-5.5",
"fallback": {
"triggerOn": {"statusCodes": ["5XX", "429"],
"errors": ["CONNECTION_ERROR", "FIRST_BYTE_TIMEOUT", "UNROUTABLE"]},
"firstByteTimeoutMilliseconds": 5000,
"targetFallback": [
{"targetName": "openai"},
{"targetName": "bedrock-mantle", "model": "gpt-5.4"}
]}}}}]'
This is AWS's own example: gpt-5.5 on Bedrock first, the same model from OpenAI next, and only then the older gpt-5.4. The order says what you value. Putting the older model second instead would keep the traffic on one provider and accept a weaker answer before paying another company.
Four behaviours decide whether fallback does what you expect:
- Only the listed failures move the request. A 400 for a malformed request is not a trigger in this rule, so it goes straight back to the caller. Status codes must be in the 4xx or 5xx ranges; a success is never retried elsewhere.
- A stalled provider needs a first-byte timeout. A provider that accepts the connection and then says nothing returns no error to react to;
FIRST_BYTE_TIMEOUTturns that silence into a trigger. Here the primary gets 5 seconds. - Streams cannot be rescued. Once the first bytes of a streaming answer have gone to the caller, the gateway cannot switch. The caller gets the partial answer and an error, and has to retry.
- The circuit breaker skips a destination that keeps failing. It is on by default. While it is open, requests go straight to the next destination instead of paying for a failed attempt first; now and then it lets a request through to test whether the primary has recovered. Turn it off only if you would rather keep trying a cheaper primary than fail over fast to a dearer one.
Fallback is invisible to the caller: one request, one response, and no field saying who served it. The gateway's routing logs record that. Each attempt is billed as a gateway invocation, and each attempt's tokens are billed by the provider that handled it.
Primary
gpt-5.5 on bedrock-mantle
Failed, moved onReturned 429, a trigger. The gateway tries the next destination. Billed as an invocation.
Fallback 1
gpt-5.5 on openai
ServedTried once and answered. The caller gets this response, with no sign of which destination served it.
Fallback 2
gpt-5.4 on bedrock-mantle
Not reachedNot tried: the request was already answered or ended.
The caller gets an answer from gpt-5.5 on openai. The gateway made 2 attempts, so 1,000,000 requests like this are 2,000,000 invocations, $10 of gateway charges. Each attempt's tokens are billed by the provider that served it.
The rule sets 429, 5XX, connection errors and first-byte timeouts as triggers on every destination. From AWS's model routing and fallback page and AgentCore pricing, read 23 October 2026.
If your models are deprecated on a schedule, a fallback to the successor model is also a safety net for the day the old one stops answering; our model retirement checklist covers the rest of that job.
Who may call, and with whose keys
Every gateway must say how callers prove who they are. Inbound, the choices are OAuthOAuthThe standard way to let one app act for you at another service without giving it your password; the app gets a limited, revocable access token instead. MCP servers use it to let AI agents sign in. with a JWT from your identity provider, IAM with AWS Signature Version 4, authenticate only (the gateway checks the token and the target decides what is allowed), or no authorization, which is for testing.
Outbound, each target gets its own credentials. Lambda and Smithy targets use the gateway's IAM role. OpenAPI and MCP server targets take an API key or OAuth client stored in AgentCore Identity, SigV4 signing, or nothing for a public endpoint. MCP targets also support three-legged OAuth, where the user signs in to the third-party service and the agent acts with that user's rights instead of one shared account. AgentCore Identity costs nothing when used through the gateway.
For checks no setting covers, a request interceptor runs your Lambda function before the gateway calls a target: reject the call, add a header, or rewrite the model name. A response interceptor does the same on the way back. For rules about which tool calls are allowed at all, AgentCore Policy checks each call against Cedar rules outside the model, where a prompt cannot argue with them; the guardrailsGuardrailChecks placed around a model that stop or change what goes in and what comes out, such as a filter on user messages or an approval step before an agent acts. page explains the difference.
Rate limits: per user, per tool, per model
A rate limit groups traffic by up to 10 keys and gives each group a rate. The keys can be the target, the tool, the model, a claim in the caller's JWT (such as sub or a team claim), the IAM principal, or a header or body field. A header or body key must sit beside an identity key, so a caller cannot dodge the limit by changing a header. Inference targets can be limited in tokens per minute, not only requests, and a rate of 0 blocks a caller outright. Rate limits are free.
Read the small print before you rely on them:
- They are checked before any routing rule, and every limit that applies must pass.
- They fail open: if the rate limit service is down or a key cannot be read from the request, the request goes through. AWS says plainly that they are not a security boundary.
- A new or idle limit can let a short burst past before it settles, and token limits settle more slowly, because a request's real token count is only known when the model finishes.
There is also no built-in cap on how long a streamed answer runs. Without a token limit on a target, one request can stream without end, and every user of that target spends from the same provider key. Our page on LLM API rate limits covers the provider side, and setting an AI agent's budget limits covers stopping spend before the invoice. The rate limitRate LimitThe most an API lets you send in a period, counted in requests and tokens per minute. Past it, requests fail with a 429 error until capacity comes back, so code waits and retries. concept explains the mechanism.
What it costs
The gateway bills by the call, and it is rarely the large line on the invoice.
| What | Price |
|---|---|
| Invocations: listing tools, calling a tool, a model request, a health check | $0.005 per 1,000 |
| Semantic tool searches | $0.025 per 1,000 |
| Tools indexed for search | $0.02 per 100 tools a month |
| Rate limits, and AgentCore Identity through the gateway | No charge |
| Data to your own VPC | $0.006 per GB in commercial Regions, plus normal data transfer |
A worked month: an agent handles 1 million conversations. Each lists its tools once, runs 1 tool search, calls 4 tools and makes 3 model requests through the gateway. That is 8 million invocations ($40.00), 1 million searches ($25.00) and 200 indexed tools ($0.04): $65.04. The 3 million model requests themselves are billed separately by the provider that serves them, and at a few thousand tokens each they usually cost far more than the gateway; the agent cost simulator prices that part. AWS's own example, an HR assistant with 200 tools, 50 million searches and 200 million tool calls a month, comes to $2,250.04.
Fallback changes the count, not the price: a request that fails on the primary and succeeds on the second destination is 2 invocations. With the breaker open, the skipped primary costs nothing. Runtime, Memory and the other AgentCore services are priced separately, in the AgentCore guide and Amazon Bedrock pricing.
When a gateway in front is worth it
Put AgentCore Gateway in front when several agents share tools, when tool calls must carry each user's own rights, when you call models from more than one provider, or when you need one place to see, limit and log all of it. It replaces the custom glue each team would otherwise write for authentication, key storage, retries and per-user quotas.
Skip it for one agent with three tools and one model: calling the tools and the model directly is simpler to debug, and the gateway's per-call price is not what you save. If your data and agents live on Databricks rather than AWS, see Databricks Unity Gateway. For connecting agents to data platforms through MCP specifically, see MCP servers for data platforms.
Questions
- What is AgentCore Gateway?
- A managed AWS service that gives an AI agent one authenticated endpoint for everything it calls. It turns REST APIs, Lambda functions, Smithy models and remote MCP servers into tools on a single MCP server, forwards traffic to other agents (including A2A agents) and HTTP services, and routes model requests to Amazon Bedrock, OpenAI or Anthropic by the model name in the request.
- How much does AgentCore Gateway cost?
- $0.005 per 1,000 invocations (listing tools, calling a tool, a model request, a health check), $0.025 per 1,000 semantic tool searches, and $0.02 per 100 tools indexed a month. Rate limits cost nothing extra. Data sent to your own VPC costs $0.006 per GB in commercial AWS Regions, and the model's tokens are billed by whoever serves the model.
- Does AgentCore Gateway support MCP?
- Yes. The gateway is an MCP server: every MCP target's tools appear in one tools/list, each tool named targetName___toolName. It can also front an existing remote MCP server, and supports MCP sessions, streaming, elicitation and sampling when you turn them on.
- Can AgentCore Gateway fall back to another model?
- Yes, since 22 October 2026. A gateway rule lists up to 2 fallback destinations, each a target and optionally a different model, and the conditions that trigger a move: chosen HTTP status codes such as 429 and 5XX, connection errors, a first-byte timeout or an unroutable target. A circuit breaker skips a destination that keeps failing. Once a streaming response has started, the gateway cannot fall back.
- Can I use the OpenAI or Anthropic SDK with AgentCore Gateway?
- Yes. Point the SDK's base URL at the gateway's /inference path (/inference/v1 for the OpenAI SDK) and authenticate with the gateway's token. The model string decides which provider serves the request; prefix it with a target name, such as openai/gpt-5.5, to pin it. Since 22 October 2026 the Bedrock InvokeModel API works through the gateway too.
- Are AgentCore Gateway rate limits a security control?
- No. AWS says rate limits fail open: if the rate limit service is unavailable or a dimension cannot be read from the request, the request goes through. New limits can let a short burst past before they settle. Use them to share capacity fairly and protect backends, and keep access control in inbound authorization and Policy.
Sources
Where each fact comes from
- 1Amazon Bedrock AgentCore Gateway: A secure AI gateway for agents, tools, and models
- 2Core concepts for Amazon Bedrock AgentCore Gateway
- 3Understand how AgentCore Gateway tools are named
- 4Search for tools in your AgentCore gateway with a natural language query
- 5Inference connector targets
- 6Inference targets
- 7Model routing and fallback
- 8Add rules to a gateway
- 9Add rate limits to a gateway
- 10Rate limit dimensions
- 11Rate limit enforcement
- 12HTTP passthrough targets
- 13Types of interceptors
- 14AgentCore Gateway service quotas
- 15AgentCore Gateway now supports Bedrock InvokeModel APIs and model fallback
- 16Amazon Bedrock AgentCore pricing