Guardrails that live inside the prompt can be talked out of. Guardrails that work live outside the model: a typed registry of what can be asked at all, risk-tiered policies that decide what needs a human, per-agent identity, a tamper-evident audit trail, and rollback for whatever gets through. Deploy them in that order, starting read-only.
“Add guardrails” has become the default answer to every AI-agent risk conversation. And most of what ships under that name is a paragraph in a system prompt: please don’t delete production resources.
Here’s the uncomfortable truth: if the enforcement point is the model, you don’t have a guardrail. You have a suggestion.
The three places a guardrail can live
In the prompt. Instructions, personas, “constitutional” rules. Cheap and flexible, but advisory. Models err, and every piece of untrusted text the agent reads is a chance for prompt injection to replace your rules with someone else’s.
In the tools. Allowlists, sandbox permissions, “ask before running shell commands”. Genuinely useful. This is where agent harnesses like Claude Code do good work. But it governs the developer’s machine, not your cloud. Once real credentials are in the environment, a permitted tool call can still do impermissible things.
In the infrastructure. A broker between the agent and the systems it operates, enforcing policy server-side. This is the only layer the model literally can’t bypass, because the agent never holds the keys and every request is validated by something that isn’t a language model.
Prompts shape behavior. Tools reduce blast radius. Infrastructure is where guarantees live. You want all three, but you can only rely on the third.
Five infrastructure guardrails, in deployment order
1. Separate identity, scoped workspace
Give each agent seat its own identity and confine it to a workspace. Half of governance is knowing, with certainty, who did what. If agent actions look exactly like yours, no downstream control can save you.
2. Typed capabilities instead of raw access
Replace “here’s a shell and credentials” with a registry of operations the agent may request: named, parameterized, risk-tiered. An operation registry turns “the agent can do things” into “the agent can do exactly these things, and we understood each one when we registered it.”
3. Risk policies with human approvals
Not every operation deserves the same ceremony. Reads run instantly, mutating operations queue for approval, and a defined set is refused outright. The approval step isn’t bureaucracy. It’s the moment human judgment enters a loop that otherwise runs on model confidence alone.
4. Tamper-evident, attributed audit
Every request, whether approved, refused, or failed, lands on an
append-only ledger carrying the agent, the human behind it, and the
outcome. Make it verifiable (hash-chained), because an audit trail you can
quietly edit is marketing, not audit. Attribution should flow into the
cloud provider too, via mechanisms like sts:SourceIdentity, so your
CloudTrail tells the same story your ledger does.
5. Rollback envelopes
The last guardrail assumes the others let something through. Eventually they will, with a human’s approval, and the human will sometimes be wrong. Capture the before-state of destructive changes so that undo is an operation, not an archaeology project.
The rollout pattern: observe → approve → automate
Teams that succeed with agent access almost always stage it:
- Observe. Read-only connection. The agent diagnoses, explains, and proposes; humans execute. Zero write risk, immediate value.
- Approve. Enable governed write operations behind an approvals inbox. The agent does the work; a human clicks the button.
- Automate. For operations with a long clean history and a rollback envelope, let policy auto-approve the lowest-risk tier.
Each stage produces the evidence you need to justify the next one: to yourself, your security team, and eventually your auditors.
The checklist
- Agent has its own identity, never shares yours
- Agent holds zero long-lived credentials (ideally zero credentials)
- Every possible action is a typed, registered operation
- Risk tiers defined; writes require human approval by default
- Append-only, verifiable audit of every request and decision
- Cloud-side attribution (
SourceIdentity) matches the ledger - Destructive operations capture rollback state
- Access is revocable by you, on your own, in one step
This checklist is basically a description of Mesoplane: typed operations, an approvals inbox, a verifiable ledger, rollback envelopes, and an AssumeRole connection you can sever in one click. But it’s also a fair test to hold against anything you build yourself. Guardrails count only if they hold when the model is wrong.
Related: What is AI agent governance? and How to give Claude Code safe AWS access.
Frequently asked questions
Are system prompts enough to control an AI agent?
No. A system prompt is a request, not a control. Models make mistakes, and untrusted content the agent reads (web pages, READMEs, tickets) can inject competing instructions. Anything you truly can't afford to have happen must be enforced by infrastructure the model can't talk its way past.
What is prompt injection and why does it matter for agents?
Prompt injection is when text an agent processes (a web page, an email, a code comment) contains instructions the model then follows. For a chatbot that's embarrassing. For an agent holding cloud credentials, it's remote code execution. OWASP ranks it as the top LLM application risk. Server-side guardrails matter precisely because injection means you can't fully trust what the agent asks for.
What's a good first guardrail to deploy?
Observe mode. Connect the agent to production strictly read-only, let it investigate and propose, and require a human to execute anything that writes. It delivers most of the value immediately, is easy to explain, and produces the usage data you need to decide which write operations deserve automation with approvals.
Let your agents operate the cloud, governed
Mesoplane turns agent requests into typed, approved, audited, reversible cloud operations. Connect an AWS account read-only in minutes.
Get started free