Guardrails on what it says, and on what it does.
The word covers two different jobs, and it helps to keep them apart.
- Guardrails on what it says screen the messages going in and out. They mask personal data, refuse attempts to take over the agent with instructions hidden in a message, and keep replies off topics the business has ruled out.
- Guardrails on what it does sit between a decision and a system of record. They decide whether an action may run, whether it waits for a person, how far a run may go before it stops, and what gets written down.
A chat assistant that only answers questions can get by on the first kind. The moment an agent can issue a refund, change a record, send a message on the company’s behalf or place a phone call, the second kind is the one that carries the risk. In e-commerce customer service that is the refund. In telecom customer care it is the change made to an account while the customer is still on the line. A polite reply that pays the wrong customer is still a wrong payment.
Most of what people fear from AI agents is an action problem that starts as a language problem: a customer talks the agent into something, a document carries an instruction it should have ignored, or the agent misreads a request. Guardrails on what it says reduce how often that happens. Guardrails on what it does decide what it costs when it does.
Why the guardrails that matter run outside the model.
There are two places to put a rule. One is in the instructions the model reads: “never refund more than the order total”, “refunds over a set amount need a manager’s approval”. The other is in code that checks every action before it runs.
An instruction in a prompt is guidance. The model weighs it against everything else it has read, on every run, and usually follows it. Usually is the problem. A long conversation, an unusual case or a message written to persuade can tip the balance, and nothing outside the model notices until the action has happened.
A rule checked in code gives the same answer every time. It does not read the conversation, so nobody can talk it out of anything. The AI proposes. The engine decides.
That is how AIOS, an AI workforce that runs your entire company, is built. Every action is policy-gated: AIOS checks it against your policies before it reaches a system of record, and you add rules where your process needs them. The policy engine is deterministic, and so is the detection of personal data. The checks that need judgment, such as whether a message is trying to take over the agent or has drifted onto a ruled-out topic, are made by a separate model, not by the one doing the work.
The layers a run should meet, in order.
No single check is enough on its own, so guardrails come in layers. This is the order a run meets them in AIOS, and what each one is there to stop.
- 1
Scope the job before it starts.
Before anything runs, AIOS decides what kind of work it is, which rules apply, which knowledge is relevant and which tools are allowed. A run is handed the systems that job needs and no others, because every extra tool is one more way to call the wrong system.
- 2
Plan before acting.
AIOS lays out what it intends to do before it does it, so the plan can be checked against policy instead of the damage being inspected afterward.
- 3
Check every action against policy.
Each action is checked against your rules as it is about to run, with one of four results: deny it, require an approval, allow it, or log it. Actions on systems you have connected are allowed unless a rule says otherwise, so you add rules where your process needs them.
- 4
Bring in an expert where a mistake is expensive.
Any step can carry an approval gate. The run pauses before it changes anything, the expert sees what is done and what is proposed next, and their decision is recorded beside the action it authorized.
- 5
Screen what goes in and out.
Personal data is masked, prompt injection is refused, and ruled-out topics are kept out of replies.
- 6
Trip a breaker when a run leaves its band.
Circuit breakers and spend caps stop a run on their own when cost, error rate or scope goes past the limits you set, so a runaway run stops itself instead of waiting for someone to notice.
- 7
Stop it by hand, instantly.
A kill switch halts one run or the whole account. The person who holds it should know it exists before the day they need it.
- 8
Write everything down.
Every action, input and output goes to an append-only audit ledger, with who approved what and why the run did what it did. Months later, anyone can reconstruct what ran, on whose authority and why.
The order matters. Scoping and planning keep most bad actions from being proposed at all. The policy check and the approval gate catch the ones that are. The breakers and the kill switch limit what is left. The ledger is how you prove all of it happened.
Writing the rules without writing code.
The usual objection to rules in code is that someone has to write the code. Policies change faster than engineering queues, so the rules fall behind, and the business goes back to putting instructions in the prompt. Building and keeping up that policy layer yourself is one of the seams that decide whether to build or buy enterprise AI.
In AIOS a policy is written the way you would explain it to a new hire. Tell the AIOS agent “refunds over a set amount need a manager’s approval”, and it writes the rule, reads it back in plain language and shows which steps of which workflows it would catch. Nothing is saved until you confirm. From then on the rule is checked in code on every action, the same way every time.
Two things make this work in practice. The person who owns the policy sees what a rule will catch before it is live, which is where most bad rules are found. And because every process in AIOS runs through one cognitive core, a rule written once applies to the phone call, the text message and the scheduled job alike, rather than being copied into each agent and drifting apart.
What guardrails can and cannot do about prompt injection.
An agent that does real work reads a lot of text it did not write: customer emails, attached documents, web pages, notes on a ticket, what a caller says. Any of it can contain instructions, and some of it will be written to look as if it came from you. This is prompt injection, and it is the problem guardrails on what an agent says are most often asked to solve.
Screening helps. AIOS refuses messages that try to take over the agent, and a separate model makes that judgment, so the model doing the work is not grading itself. But no filter that reads language catches every attempt, because an attacker only has to find one wording the filter misses.
The stronger defense is the one that does not read language at all. If a refund over a set amount needs a manager’s approval, an email that persuades the agent otherwise still produces a request for approval, not a refund. If the run was never handed the tool that changes bank details, no instruction can make it change them. Scope and policy checks limit the damage of an injection the filter missed. That is the reason to ask for both.
Test the guardrails before go-live, and keep testing after.
A guardrail nobody has seen fire is an assumption. Before a workflow goes live, Proof runs a suite of test cases through it end to end, scored against a pass mark, and nothing is sent, posted or paid. Include the cases the guardrails exist for: the customer who asks for more than policy allows, the document with an instruction buried in it, the request that should go to a person.
Voice needs tests of its own, because a call moves at the pace of a conversation. AIOS tests a voice agent with simulated callers, each with a goal and a voice, who may cut in mid-sentence and call over a clean, typical or poor line. Every call is scored.
After launch the question changes from whether it works to whether it still works. The policies, tools and conditions around an agent keep changing, and its behavior can drift from the version that was tested while it keeps running; the agent lifespan problem explains why. Two things keep guardrails honest over time. One is a report of every time a guardrail or policy rule fired and what it did: blocked the action, corrected it, masked it, handed the case to a person or only watched. The other is Nightshift, which reviews the day’s runs every night and prepares the fix for what is drifting, waiting for your yes.
Where to put guardrails first.
You do not need a rule for everything on the first day. Start where a mistake is expensive or cannot be taken back.
- Anything that cannot be undone. A sent message, a payment, a filed claim, a closed account. An approval gate or a deny rule goes here first.
- Anything a customer or a regulator sees. Messages, documents and calls that leave the company carry its name.
- Amounts that change the risk. A small credit and a large refund are the same action. A rule can depend on the amount, the customer or the account, not only on the step.
- Personal data. Decide what must never appear in a reply, and mask it.
- Cost. A spend cap, so a run that loops stops itself.
- The stop. Decide who holds the kill switch before launch, not during an incident.
Then resist gating everything. An approval on every step teaches people to click yes without reading, and a gate that approves everything protects nothing. What an approval gate should cover goes through where a gate earns its place and what the reviewer needs to see.
Questions to ask any vendor about guardrails.
Every agent product says it has guardrails. These questions separate the ones that hold in production from the ones that hold in a demo.
- 1
Is the action check in code, or in the prompt?
If a rule lives only in the instructions, the model can be talked out of it.
- 2
What happens to an action no rule mentions?
Know the answer before launch, and know how to add a rule when it is not the answer you want.
- 3
Who can write a rule, and can they see what it will catch first?
If every policy change needs an engineer, the rules will lag behind the business.
- 4
Which checks are deterministic, and which are judged by a model?
Both have a place. You should know which is which, and no model should be judging its own work.
- 5
Can one run be stopped without stopping everything?
And can everything be stopped at once? You will want both, and you will want them instant.
- 6
Is every firing recorded?
A guardrail that leaves no trace cannot be audited. Ask to see the report, and the record behind one decision.
- 7
Does one rule cover every channel?
If the phone agent and the chat agent each carry their own copy of a rule, the copies will drift apart.
- 8
How are the guardrails tested before go-live?
Ask for the test cases that make each one fire, not only the ones that pass.
For the evidence an auditor asks for afterward, see how to audit an AI agent. For how these controls fit together in AIOS, see AI agent governance and the Governance page.
Questions.
What are AI agent guardrails?
Checks that limit what an AI agent may say and do while it works. Guardrails on what it says mask personal data, refuse prompt injection and keep replies off ruled-out topics. Guardrails on what it does check each action against policy, pause for an expert’s sign-off, stop runs that go past cost or scope limits, and record every decision.
What is the difference between guardrails and AI governance?
Guardrails are the individual checks. Governance is the whole system around them: who sets the rules, how they change, how runs are tested and reviewed, and the record that proves what happened. A guardrail without governance is a check nobody owns.
Are AI guardrails deterministic?
Some can be and some cannot. In AIOS the policy engine and personal-data detection are deterministic: the same action gets the same answer every time. Judging whether a message is a prompt injection or off topic needs a model, so a separate model makes that call, not the one doing the work.
Can guardrails stop prompt injection?
They reduce it, but no filter that reads language catches every attempt. The stronger defense limits what an injected instruction could achieve: a run has only the tools its job needs, and every action is checked against policy in code before it reaches a system of record.
What happens when a guardrail fires?
It depends on the rule: the action is blocked, corrected, sent to a person for approval, masked, or allowed and logged. AIOS records each firing and counts it in a report, so you can see which rule fired, how often and what it did.
Do we need an engineer to write guardrail rules?
Not in AIOS. Describe the policy to the AIOS agent in plain language. It writes the rule, shows which workflow steps it would catch, and saves nothing until you confirm.