Your Agent's Safety Isn't in the Prompt. It's in What You Let It Touch.
Every vendor selling an "agent platform" will tell you their model is aligned, their prompts are hardened, their guardrails are robust. Strip the marketing and the truth is uglier: a prompt is a suggestion. The only thing standing between your agent and a deleted database is the set of actions it can actually choose from — and most teams never bothered to define that set at all.
This is the piece about the action space: the tools exposed, the argument values allowed, the state changes permitted. Get it wrong and your agent doesn't need to be jailbroken. It just needs to hallucinate once, or read one poisoned ticket.
The prompt is not a boundary
OWASP's framing of excessive agency is blunt: the vulnerability is damaging actions in response to unexpected, ambiguous, or manipulated model outputs — regardless of the trigger. A hallucination is enough. An instruction buried in a support ticket the agent reads is enough. If the tool exists and the arguments are open-ended, the agent can reach it. A prompt telling it not to is a hope, not a control.
Fewer tools beats smarter prompts
The highest-leverage move is also the simplest: expose fewer tools. OWASP's prevention guidance starts with minimising tools, minimising tool functionality, and avoiding open-ended tools. If the agent only summarises mail, give it a read-only mail tool — not one that can also delete and send. A general shell tool is a loaded gun next to a task-specific file writer that does exactly one thing.
The same rule applies where tools arrive through an MCP server. The server's tool list bounds what the agent can see and propose. Leaving a tool listed and relying on a prompt to discourage its use does nothing.
A schema is not authorisation
A strict argument schema — named arguments, types, enums, ranges, allowed targets — narrows the space, but the schema alone authorises nothing. Application code has to validate arguments against the schema and the current state before execution, and reject or clamp out-of-range values with a defined fallback instead of silently fixing them. A refund is only valid when the order is actually in a refundable state. A fixed list of tool names can't express that; the harness has to check.
Enforce it in code, or don't pretend it's enforced
OWASP's complete-mediation principle says it plainly: implement authorisation in logic rather than relying on a model to decide whether an action is allowed. Tool guardrails in the OpenAI Agents SDK run on every guarded invocation — allow, reject, or tripwire-halt. NVIDIA's NeMo Guardrails offers the same pattern in other stacks. And for actions that are permitted but high-impact, the control is a human: pause the run, approve or reject, resume. LangChain's human-in-the-loop middleware does exactly this, saving graph state so execution resumes after review.
Identity, permissions, and sandboxing are outer bounds, not substitutes. Least privilege per tool, run untrusted code in an ephemeral VM — and still treat tool output as untrusted.
The support agent that proves the point
Take a support agent whose first version can read and send mail, update and delete tickets, run shell commands, fetch arbitrary URLs, and touch billing records. One injected instruction in a ticket has a buffet of harmful actions to aim at, and the prompt is the only boundary.
The narrowed version can read a ticket by ID, add an internal note, and look up an order. It can prepare a refund — a draft with a fixed amount, a named order, a ticket ID — but not issue one. No mail-send tool, no delete tool, no shell, no URL fetch. Anything outside that set gets refused by the harness before execution, and the refusal tells the planner which valid action to pick instead.
Test it like an attacker would
Write misuse cases that try to reach actions outside the defined set — through ordinary messages and through content the agent reads. Each attempt should end in a harness refusal. If a test reaches a harmful action, that's a defect in the action space, not a prompt-tuning task. Log every denial with the tool, the arguments, the rule, and the state, and review that log before anyone proposes widening the space again. Widening needs evidence, schemas, state checks, approval rules, and misuse tests — or it doesn't happen.
The uncomfortable takeaway: most "agent safety" work is prompt engineering dressed up as security. The teams that actually ship safe agents are the ones who decided, in advance and in code, what their agent is allowed to do — and made everything else impossible, not merely discouraged.
Go deeper
Read the full guide on Agentic Affairs: How Developers Constrain the Agent Action Space for Safety
Originally published on Agentic Affairs (https://agentic-affairs.com)
