Content Guardrails for AI Agents: Inside the Rule Builder
The question a content guardrail answers
Tool scoping answers "what can this agent do." A content guardrail answers a narrower, equally uncomfortable question: "what can this agent say." Those are different failure modes. An agent with perfectly scoped tools, read-only access to your CRM, no ability to send email, can still answer a customer's question by quoting a phone number it shouldn't have repeated, or discussing a competitor's pricing because a user asked it to, twice, differently worded. Tool and permission guardrails stop the agent from taking an action; content guardrails stop it from saying something.
Oido Studio ships both, as separate systems, because they're different problems. This post is about the second one: the rule builder under Guardrails in the agent's team settings.
Two directions, checked separately
Every guardrail applies to one of two points in a conversation:
- Input — the user's message, checked before the agent ever reasons over it. This is where you catch a request that's off-policy on its face.
- Output — the agent's finished answer, checked before it reaches the user. This is where you catch something the model produced on its own that shouldn't go out, a leaked detail, an answer that drifted into territory you've ruled off-limits.
The two are independent because the failure they guard against is independent. A clean input can still produce a bad output; a policy-testing input should never reach the model's answer at all. In the builder, a rule with direction set to "Input + Output" runs the same check both ways, useful for a blanket restriction, most rules are narrower on purpose.
Five rule types, two different mechanisms
The builder gives you five rule types, and they split into two families:
| Rule type | What it checks | Cost |
|---|---|---|
| Keyword | A list of terms, case-sensitive or not | Near-zero, string match |
| Pattern (regex) | A regular expression | Near-zero, string match |
| Personal info (PII) | Declared types, email, phone, SSN | Near-zero, pattern match |
| Category | A labeled term list under a taxonomy tag | Near-zero, string match |
| Written policy | A plain-English sentence, judged by a model | One extra LLM call |
The first four are structured: deterministic, synchronous, and cheap enough to run on every message without a second thought. The fifth, written policy, exists because some rules can't be written as a pattern at all. "Never discuss competitor pricing, even if asked directly" has no regex. For that shape, you write the policy in plain English and a classifier model checks the content against it, catching paraphrases and intent that a keyword list would miss by one synonym.
That extra model call is real cost and real latency, which is why the engine only pays for it when it has to: structured rules run on every message regardless; the written-policy pass only fires if your org has actually configured one for that direction. An org running purely on keyword and PII rules never triggers a judge call, and never pays for one it didn't ask for.
The judge itself uses your own connected provider, the same live model picker the agent's composer uses elsewhere in Oido Studio, so a written-policy rule runs against real, currently-keyed models in your organization, not a placeholder that assumes you've set up a provider you haven't.
Org-wide and agent-specific, and only one direction of override
A guardrail is scoped one of two ways: organization-wide, applying to every agent you run, or agent-specific, applying to one named agent in addition to the org's global rules.
The important design choice is what happens where those two overlap: nothing does, by construction. Global rules apply to every agent. An agent-specific rule can only add to that; it can never loosen or disable a global rule for one agent. There's no toggle, no exception field, no per-agent override of a company policy. That's a deliberate simplification: it removes a whole category of misconfiguration, an admin accidentally exempting one agent from a rule the rest of the company is bound by, by making that configuration impossible to write rather than something you'd have to remember not to write. The effective rule set for any given run is just the union: every global rule, plus whatever this agent added on top.
Generate with AI: writing a rule from a description
Structured rules can also be error-prone in the other direction, a plausible-looking regex that quietly misses the case you meant to catch, so the builder includes a Generate with AI action. Describe the policy in a sentence, pick a model, and it drafts a rule for you.
Worth being precise about what it does and doesn't do. It never writes a keyword list or a regex, and never saves anything on its own. It always drafts a written-policy rule, because that's the one rule type that can losslessly represent an arbitrary description, turning a vague sentence into policy language is a safe, honest task; having a model construct a deterministic pattern from the same vague sentence is not, because a subtly wrong regex still looks valid and won't announce itself until it fails to catch a real violation. The draft lands in the form for you to review, and you still hit Create. If you'd rather have the cheaper deterministic version, you can always rebuild the rule manually afterward, generation doesn't lock you into the written-policy shape, it just doesn't guess at the alternative for you.
Who gets to touch this
Guardrails are a permissioned resource in team settings, not open by default the way some lower-risk areas are. An admin grants or revokes a team member's access to the Guardrails page the same way they manage access to agents, tools, or connected providers, which matters because a guardrail is itself a security control: the ability to edit one is the ability to loosen the company's content policy.
What a hard block actually costs you
On a match, the message is blocked, no redaction, no partial pass-through, just a clear stop naming the rule that fired. That's a heavier hammer than some teams expect on their first PII rule; blocking an entire response because it contained one phone number can feel like overkill next to just removing the phone number and sending the rest. It's the right default for a first pass, a block is unambiguous and auditable, a redaction changes content in a way that needs its own review. If your evaluation across testing an agent before production turns up rules that block more than they should, the fix is almost always narrowing the rule, not disabling the mechanism, a category rule that's too broad is a five-minute edit, a written-policy sentence that's too aggressive is a shorter sentence.
Where this fits in the bigger picture
Content guardrails are one layer. They sit next to tool scoping, approval gates and audit logs, next to the origin controls that matter when an agent operates inside a real browser session, and next to the weekly discipline of watching whether an agent still works. None of them substitutes for the others: a perfectly scoped agent can still say the wrong thing, and a perfectly policed conversation can still be run by an agent with too much reach. Together, they're what makes the statutory version of this conversation something you can walk into with evidence instead of a promise.
It's also, in practice, the fastest way to answer the question every rollout eventually gets asked: not "is the model good," but "what exactly can it say, and can you prove it." With a rule set an admin owns, scoped by org and agent, logged on every match, the honest answer is a screenshot of the Guardrails page. That's how every agent we run is configured before it touches a real conversation.
Frequently asked questions
What is a content guardrail for an AI agent?
A rule that scans what goes into or out of an agent's conversation and blocks it if it matches: a banned keyword, a regex pattern, a detected PII type, or a written policy checked by a second, smaller model. It's a different layer from tool scoping, it governs what the agent says, not what it's allowed to do.
What's the difference between input and output guardrails?
Input guardrails check the user's message before the agent sees it, catching prompt injection and policy-violating requests at the door. Output guardrails check the agent's finished answer before the user sees it, catching leaks and off-policy responses the model produced on its own.
Can an agent override a company-wide guardrail?
No. Global, org-wide rules apply to every agent; an agent-specific rule can only add restrictions on top, never loosen or disable a global one. There's no override mechanism, by design.
Do written-policy guardrails slow down every response?
Only if you configure one. Structured rules (keyword, regex, PII, category) are near-instant string checks that always run. The written-policy rule type adds one extra model call, and it's only invoked when your org has actually configured one for that direction.