Kong AI Gateway: what it does and when to use it for AI agents
Think of Kong AI Gateway as a reverse proxy for AI traffic. The agent does not send requests directly to individual models and tools, but to internal Kong endpoints. The gateway authenticates the calling application, applies limits and security rules, selects the target service and records operational metrics.
Kong is neither a language model nor a framework for building agents. The agent still plans steps, keeps state and decides when to call a tool. Kong sits in the data path of those calls and handles their operation: authentication, routing, provider credentials, limits, fallbacks and audit.
Short answer: Kong AI Gateway makes the most sense where several applications or teams use multiple models, MCP servers and agents and need unified rules over them. It is an especially natural choice in a company that already uses Kong for regular APIs.

What Kong is and why it comes up with AI agents
A classic API gateway sits in front of backends: it accepts an HTTP request, authenticates the client, finds the matching route and passes the request to the upstream service. Kong AI Gateway extends this model with protocols, formats and metrics typical of generative AI.
In an agent system, three separate data paths usually meet:
- Agent → model: HTTP calls to OpenAI, Anthropic, Gemini, Mistral or your own model. Here Kong can unify the format, hide provider keys and select the target model.
- Agent → tool: calls to a database, CRM, repository or internal API, increasingly via the Model Context Protocol (MCP).
- Agent → another agent: delegating tasks to specialised agents, for example via the Agent2Agent Protocol (A2A).
An important distinction: this is not one “magic” endpoint. LLM, MCP and A2A traffic use separate routes and plugins. When the model returns a tool_call, Kong does not run the tool automatically. The agent runtime processes the result and then sends a separate MCP call, which can again pass through Kong.
The ability to manage these paths on a single gateway is Kong’s main advantage. The application team keeps orchestration in the agent code, while the platform team sets shared operational rules in Kong or in the Konnect control plane.
We explain the difference between the path to models and the path to tools in more detail in the article LLM gateway and MCP gateway: two gates for enterprise AI. Here we focus directly on Kong and its alternatives.
What Kong AI Gateway actually does
1. A single entry point to multiple models
The application does not have to manage each provider’s SDK, URL and API key separately. It can send, for example, an OpenAI-compatible request to its own Kong route. The AI Proxy plugin translates the request into the chosen provider’s format and converts the response back. The real model keys can therefore stay in the gateway configuration instead of in every application.
AI Proxy Advanced adds multiple targets, load balancing, retry, circuit breaker and fallback. The gateway can pick a model by round-robin, by latency, by consumption or by semantic similarity of the prompt to the model description. If the primary target fails, it can hand the request to another provider.
A compatible HTTP format does not mean identical behaviour, though. Before deploying a fallback, test streaming via SSE, the tool_calls structure, structured output, finish reasons and error responses. In addition, a retry after a timeout can create a second paid request even though the first upstream request is already running.
For an agent this layer is practical for two reasons: the code is not hard-wired to one provider, and the model-selection rules are not copied into every application. The decision whether a response is good enough for a given task, however, still belongs in the application’s tests and evaluations.
2. Limits, costs and prompt protection
Classic API limits count requests. With AI, however, one request can cost a thousand times more than another. Kong can therefore also work with tokens and, for selected features, with estimated costs. Policies can be applied centrally by client, application or user group.
Other plugins handle, for example:
- rate limiting by requests, tokens or cost;
- caching for identical or semantically similar queries;
- allowed and forbidden topics in prompts;
- modifying system instructions and prompt templates;
- logging latency, errors, tokens and other metrics.
Not all advanced features are part of the free edition. For example, AI Proxy Advanced and some related plugins belong to the enterprise tier. When comparing solutions, it is therefore not enough to check the feature list — you also need to verify the licence and operating costs.
3. A gateway for MCP tools
Support for the Model Context Protocol is essential for AI agents. Kong AI MCP Proxy can sit in front of an existing MCP server, but it can also turn a regular REST API into MCP tools. A company therefore does not have to rewrite every internal service just so that an agent can use it.
Kong can aggregate several tool sets into a single MCP endpoint. On top of it, it applies authentication, traffic limits, audit and permissions for specific tools. The agent sees, for example, the tool for reading orders but not the tool for deleting them.
This solves a common problem of fast-growing agent projects: every client has its own list of MCP servers, its own keys and different permissions. With a gateway, the client connects to one place and the rules are managed centrally.
According to current documentation, AI MCP Proxy requires Kong Gateway 3.12 or newer. When designing the architecture, it is therefore important to check the specific gateway version and the MCP protocol version used by the upstream servers.
4. Governing agent-to-agent communication
Besides MCP, Kong also supports traffic over A2A. MCP standardises mainly access to tools and data, whereas A2A handles communication between independent agents. Here the gateway can verify identity, restrict access, measure traffic and create an audit trail, just as with regular APIs.
This is useful, for example, when a sales agent delegates a contract check to a legal agent and a price calculation to a pricing agent. Without a central layer, yet another web of mutual connections, tokens and logs emerges. A gateway can unify it.
What a request through Kong looks like
Klient
↓
Agent runtime (plánování, stav, smyčka volání nástrojů)
├── HTTP / LLM route ──→ Kong + AI Proxy ──→ model
├── JSON-RPC / MCP ────→ Kong + MCP Proxy ─→ nástroj nebo API
└── JSON-RPC / A2A ────→ Kong + A2A Proxy ─→ jiný agent
Na gateway: autentizace · oprávnění · routing · limity · audit · metriky
For a model call, the sequence is typically as follows:
- The agent sends a
POSTto a route defined in Kong. The body can have an OpenAI-compatible format if the route is configured that way. - Kong verifies the application’s identity, checks the quota and applies guardrails or other plugins.
- AI Proxy selects the upstream model, adds its credentials and, if necessary, translates the request format.
- The response or SSE stream passes back through the gateway, where latency, tokens and errors can be measured.
- If the model returns a tool request, the agent runtime processes it and creates a new MCP call. The gateway itself does not drive the agent loop.
response = llm.chat(messages) # přes LLM route v Kongu
while response.tool_calls:
results = mcp.call(response.tool_calls) # samostatná MCP route
messages += [response, results]
response = llm.chat(messages)
return response.text
Imagine a customer-support agent. First, via the LLM route, it classifies the query with a cheaper model. Then, via the MCP route, it loads the order status; the gateway checks whether the agent’s identity may use this particular tool. The agent can hand a complex case to a complaints agent via the A2A route.
A shared trace ID does not appear automatically. The agent must propagate the trace context between individual calls, for example the traceparent header, and both the gateway and the application must export telemetry to the same system. Without that you will see three separate requests.
The practical rule is simple: the agent decides what should be done; the gateway decides whether and which way the traffic passes. Business logic stays in the agent, but operational and security rules don’t have to be reimplemented in every application.
What Kong does not solve
The words “AI Gateway” may give the impression of a complete agent platform. But Kong by itself:
- does not design the agent loop or decide how the agent plans;
- does not replace LangGraph, CrewAI, Semantic Kernel or your own orchestration;
- does not automatically store long-term memory and task state;
- does not address response quality without an evaluation process;
- does not guarantee a tool’s safety just because its traffic passes through the gateway;
- does not replace human approval of risky actions.
A gateway is a control point, not the agent’s brain. If an agent has overly broad permissions, a badly designed tool or an infinite loop, deploying Kong alone will not remove the problem. It can, however, help restrict permissions, stop traffic and trace an incident afterwards.
Kong and similar solutions: how they differ
There is no single best AI gateway for everyone. The products differ mainly in the world they grew out of.
LiteLLM: a quick self-hosted entry point to models, MCP and A2A
LiteLLM started as a Python proxy unifying a large number of LLM providers. Today it also offers an MCP Gateway and an Agent Gateway for A2A. It supports virtual keys, budgets, rate limits, routing and a shared catalogue of models, MCP servers and agents.
Choose LiteLLM when you want to get your own gateway running quickly, the main problem is access to multiple models and you don’t want to introduce a full enterprise API platform. Bear in mind, though, that you will run the database, Redis, updates and availability of the self-hosted installation yourself.
Portkey: a product focused directly on AI operations
Portkey combines an AI gateway, observability, guardrails and prompt management. Its MCP Gateway centralises authentication, permissions, credential injection and tool logging. Model and MCP calls can be part of the same trace.
Choose Portkey when you want a more finished AI-native platform with a dashboard and don’t want to assemble most operational features from plugins. Compare the managed and self-hosted variants, licence terms and data-storage requirements carefully.
Envoy AI Gateway: for cloud-native and Kubernetes teams
Envoy AI Gateway builds on Envoy Proxy and the Kubernetes Gateway API. It offers LLM provider integration, an OpenAI-compatible interface, token limits and fallbacks. It is a natural fit for platform teams that already use Envoy, Kubernetes or a service mesh and want to govern AI traffic with the same declarative mechanisms.
Choose Envoy AI Gateway when performance, open cloud-native infrastructure and deep Kubernetes integration are key for you. For a small team without platform experience, running it may be unnecessarily demanding.
Cloudflare AI Gateway: a fast managed layer at the edge
Cloudflare AI Gateway focuses on quick adoption of a managed service: logs and analytics, caching, rate limiting, retry, fallbacks, guardrails and spending limits. It is particularly suitable where the application already runs in the Cloudflare ecosystem or the team does not want to operate its own proxy.
Choose Cloudflare when you want the smallest possible operational overhead and the main topic is model calls. If you need detailed management of internal MCP tools or a whole API portfolio, check whether the product’s current scope covers your requirements.
Tyk: API and MCP governance with fine-grained permissions
Tyk extends traditional API management with an MCP Gateway. It can control access not only to the server as a whole but also to individual tools, resources and prompts. It supports OAuth scopes, policies, limits and filtering of JSON-RPC methods.
Choose Tyk when you need detailed governance of MCP traffic and want to combine it with the management of regular APIs. As with Kong, you need to compare the specific edition and the scope of paid features.
What about OpenRouter?
OpenRouter is a very practical unified entry point to a large number of models and supports routing and fallbacks. But it is not a direct replacement for a full gateway for internal APIs, MCP tools and A2A communication. It is better understood as a hosted model router.
How to choose the right AI gateway
Start with the operational problem, not the product name:
- You already run Kong: look at Kong AI Gateway first. You will reuse existing know-how, policies and observability.
- You want a quick self-hosted start: LiteLLM tends to be the simpler entry, especially if you mainly deal with models and budgets.
- You want a ready-made AI operations platform: compare Portkey and other AI-native services.
- You are a Kubernetes platform team: Envoy AI Gateway makes sense.
- You want a managed edge service: look into Cloudflare AI Gateway.
- You need fine-grained MCP permissions in API management: compare Kong and Tyk on a specific scenario.
In a pilot, don’t test just a simple non-streamed prompt. Verify at least:
- the added latency and time to first token for a streamed response;
- behaviour on timeout, outage and hitting the provider’s rate limit;
- whether retry or fallback creates duplicate requests and costs;
- compatibility of
tool_calls, structured output and error formats between fallback models; - accuracy of token, cost and calling-application identity measurement;
- trace context propagation and access restriction to a specific MCP tool.
A marketing feature list won’t show how easy the solution will be to operate in your environment. The decisive factor is a test on your agent’s real request flow.
Common mistakes when deploying a gateway
- One universal key for all agents. Every application and team needs its own identity, limits and permissions.
- Logging sensitive prompts without rules. Observability must not create a new store of personal data and secrets.
- Fallback without a quality test. A different model may return a different format or call tools worse, even if the API is compatible.
- Assuming that “OpenAI-compatible” means interchangeable. Test streaming, tool calls, structured output and error mapping separately.
- Automatic retry of every request. After a timeout you may not know whether the upstream accepted the request. For MCP and A2A writes, a repeat can also double the side effect.
- Too many tools for every agent. Offer only the smallest necessary set; you improve both security and the model’s tool selection.
- Mistaking the gateway for a security spell. Prompt injection is also addressed by limited permissions, argument validation and confirmation of irreversible actions.
- Dependence on a proprietary feature without an escape route. Verify configuration export, supported standards and the option to change vendor.
So when does Kong make sense?
Kong AI Gateway is a strong choice for organisations with multiple teams, models and internal APIs that need unified governance over agent traffic. Its biggest advantage is not a single “AI feature” but the combination of model, MCP and A2A traffic with mature API-management principles.
For a small prototype, Kong may be unnecessarily robust. There, a direct API or LiteLLM is often enough. But once an agent gains access to company systems, uses multiple providers and its outage or error has a business impact, a central gateway stops being a luxury.
Want to not only assemble AI agents but also run them safely?
In the AI Agent Developer course you work hands-on with models, tools, MCP and the security of agent applications. If you are interested in using AI directly in the developer workflow, also take a look at the Vibe Coding and AI in Software Development course.