Request Termination Policy

The Request Termination AI Policy terminates incoming requests with a status code and message that you define. Use it to temporarily stop traffic to an AI Model, AI Agent, or AI MCP Server, or to block a specific AI Consumer.

When the policy is enabled, every request within its scope is immediately terminated with the configured response. You can also use the policy for debugging, by echoing the request back to the client with the config.echo parameter.

Example use cases

The following table lists some common use cases for the Request Termination policy:

If you want to…

Then see…

Temporarily disable an AI Model

For example, if the AI Model is under maintenance and clients keep retrying
Block requests with an error message
Temporarily disable an AI Agent or AI MCP Server

For example, if one entity is misbehaving while the rest of your AI Gateway traffic is healthy
Block requests with an error message
Temporarily disable an AI Consumer or AI Consumer Group

For example, if a consumer has excessive consumption
Block requests with an error message
Debug erroneous requests in live systems using config.echo Echo response back to client

Scopes

Apply the Request Termination Policy globally to terminate all AI Gateway traffic on the data plane, or attach it to an AI Model, AI Agent, AI MCP Server, AI Consumer, or AI Consumer Group to terminate traffic for that entity only.

For an AI Consumer or AI Consumer Group, the policy takes effect only after the client authenticates. A request without valid credentials is rejected by the authentication method before the policy runs.

For details about how scopes work, see AI Policy scopes.

Execution order

The Request Termination Policy has priority 2, so only the Mocking and Post-Function Policies run after it. Policies such as guardrails still run before termination, so they can consume calls or fail first. For details, see AI Policy priority.

Looking for on-prem configuration? Convert the kongctl configuration to a decK yaml file and use deck file ai2kong. See Configure Kong AI Gateway on-prem for more information.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!