As of November 2026, prompt injection in an AI agent is input that changes the agent's behavior or output in ways its developer did not intend, as OWASP's LLM01 entry describes. A direct injection comes from a user message; an indirect injection comes from content the agent reads, such as an email, web page or tool result. Limit the damage with tool permissions and action approval in the agent or tool, plus model allowlists and per-key spend caps at the gateway. In Requesty's October 2026 data, 7.2% to 66.2% of qualifying requests across the busiest providers ended in a tool call.
How an injection turns into an action
Take a hypothetical email assistant: a user asks it to summarize a message, and the message contains an instruction to send private information elsewhere. If the agent treats that instruction as part of the user's task and has permission to send the information, the injected text has crossed from data into an action.
EchoLeak (CVE-2025-32711) showed the risk in production: an AI command injection in Microsoft 365 Copilot let an attacker disclose information over a network.
What share of qualifying requests ended with a tool call? In our October 2026 tool-call data, the answer varied across the busiest providers. Five of them:
| Provider | Share of qualifying requests ending with finish_reason set to tool_calls | Share of output tokens in tool-call responses |
|---|---|---|
| Anthropic | 22.7% | 23.4% |
| OpenAI | 13.7% | 21.4% |
| Bedrock | 20.2% | 26.1% |
| Vertex (Claude) | 36.0% | 46.6% |
| Melious | 66.2% | 66.4% |
The note counts successful requests with output tokens as qualifying requests and identifies a tool call when finish_reason is tool_calls. The request-share column shows how often qualifying requests ended with that finish reason.
Put authorization next to the action
The first control to build is a tool allowlist in the agent: give each agent access to the tools its task requires. Run the agent under the delegated end-user identity where possible. This follows the least-privilege advice in OWASP's LLM01 entry.
Then check the proposed action at the tool boundary. A model can request an action, but the tool should check whether the user is authorized and whether the parameters are valid before performing it. OWASP's prompt injection guidance recommends placing validation next to the tool that creates the side effect.
Restrict external communication when the task does not need it, including sending email, making HTTP requests or opening links. Simon Willison calls this the lethal trifecta: an agent has access to private data, reads untrusted content and can communicate externally. Removing external communication can break that path.
| Control | Where it runs | What it limits |
|---|---|---|
| Tool allowlist | Agent application | Which tools the agent can request |
| Permission and parameter checks | Tool boundary | Which actions the tool will perform |
| Human approval | Agent workflow | Sensitive actions before execution |
| External communication restrictions | Agent application and tool boundary | Where the agent can send data or make requests |
| Model allowlist | Requesty gateway | Which models the agent key can use |
| Monthly spend cap | Requesty gateway | New model requests after the key reaches its cap |
| Run or step limit | Agent application | How long an individual task can continue |
Human approval is useful for sensitive actions, but the approval gate has to interpret the action correctly. A shell command allowlist needs to account for what the shell will execute.
Keep untrusted content in its proper place in the request, too. OpenAI's agent safety guide recommends passing untrusted inputs through user messages and using fixed schemas or enums between workflow nodes to reduce freeform channels.
Use the gateway to limit model access and spend
An AI agent gateway sits on the model request path. It can refuse a model request, but the agent and its tools still need to decide whether a proposed action is allowed.
With Requesty's Approved Models, an organization can set a model allowlist, then narrow access for a group or API key. For an autonomous agent, the documented pattern is to attach a one-model access list to its key. Requests for models outside the allowlist are refused before a token is spent.
Give each agent its own key as well. A cap on a shared application key applies to every agent using it; a separate key gives each agent its own monthly limit and makes spend easier to attribute. When a key reaches its limit, Requesty blocks new requests and returns HTTP 412, as described in our guide to per-customer keys and budgets.
Our guardrails scan request content for PII and secrets. They do not detect prompt injection or moderate harmful outputs. A separately wired safety service can add a detection layer, but OpenAI's agent security research advises against relying on input filtering alone: attacks can look like social engineering, and defenses need to constrain the impact of manipulation.
What a monthly cap looks like
Our October 2026 coding benchmark tested agents on 129 private Go backend tasks. Each model had the same tools (Bash, read, edit and write), a sandboxed repository and an 80-turn budget. Claude Sonnet 5.5 cost $0.52 per task and solved 87.6% of tasks; Claude Opus 5.5 cost $0.93 per task and solved 92.2%.
Take a $100 monthly cap for one agent. If its average task costs match those benchmark averages, the cap covers:
| Benchmark model | Mean cost per task | Estimated cost for 100 tasks | $100 divided by mean cost |
|---|---|---|---|
| Claude Sonnet 5.5 | $0.52 | $52 | About 192 tasks |
| Claude Opus 5.5 | $0.93 | $93 | About 107 tasks |
Task cost varies, so treat the division as a planning estimate. The cap could be reached during a task.
If the Sonnet average doubled to $1.04 per task, the same $100 would cover roughly 96 tasks at that average. A monthly budget also does not tell an agent when to stop one task, so set a separate run or step limit in the application, as our guide to capping runaway agent spend explains.
Review the agent before giving it access
Start with an agent's most consequential tool and trace the request path through to the action. Check the agent's permissions, then check the tool that performs the action. Put gateway limits around the model requests and review what the agent does with the access it has.
Before an agent reads untrusted content
0 of 8 done
Requesty request logs include the model, provider, token count, cost, latency and finish reason; a trace_id can group an agent run. The key security view also flags a new tool on the key (a coding agent, app or SDK, named from its User-Agent and X-Title headers) and traffic spikes. Use those records alongside tool invocation logs: the model request and the action it led to belong in the same review.
Frequently asked questions
- What is prompt injection in an AI agent?
- Prompt injection is input that changes an AI agent's behavior or output in ways its developer did not intend, as OWASP's LLM01 entry describes. A direct injection comes from a user message; an indirect injection comes from content the agent reads, such as an email, web page or tool result.
- Can an AI gateway stop prompt injection?
- A gateway can limit which models an agent can use and how much it can spend. Requesty's gateway does not detect prompt injection, so tool authorization and approval for sensitive actions need separate controls.
- Where should tool permissions be enforced for an AI agent?
- Enforce tool permissions and validate parameters in the agent and at the tool that performs the action. OWASP recommends placing validation next to the tool that creates the side effect.
- How do Requesty spend caps work for AI agents?
- Each Requesty API key can have a monthly spend cap. Once the cap is reached, Requesty blocks new requests for that key and returns HTTP 412.
- How often do requests through Requesty end in a tool call?
- In Requesty's October 2026 data, 7.2% to 66.2% of qualifying requests across the busiest providers ended with the finish reason tool_calls. Qualifying requests were successful requests with output tokens.
- OCT '26
AI Agent Gateway: How to Govern Agent Traffic in 2026
An AI agent gateway governs traffic to models, tools and other agents. Compare security controls and learn how to test each path in your company.
- SEP '26
Every agent uses the same key: why shared credentials break spend attribution and what to do instead
In the last 72 hours the same problem surfaced independently in r/AI_Agents, r/mlops, r/ciso and r/sysadmin: hundreds of agent instances on one API key, an invoice that is one number, a security team saying shared keys are bad, and an engineer who cannot see how managing hundreds of credentials is better. Gateway questions on Reddit ran 5.6x the prior 72 hours. Here is the answer: identity per agent is a routing layer feature, not a secrets management project.
- JUL '26
$1.8k before anyone noticed: how to cap runaway agent spend
Retry storms, agent loops, and stolen keys are the three ways teams lose four figures of LLM budget in a day. A practical setup for hard caps, per key limits, alerts, and loop detection.
