New: Auto Approval Workflows and Agent Session Review

See what shipped →

What Are AI Guardrails?

AI guardrails are the rules, checks and limits that keep an AI model or agent inside boundaries a team defines, so the AI stays safe, accurate and compliant. Guardrails run before the AI acts, on inputs and context, while it acts, on tools and permissions, and after it acts, on outputs.

For AI coding agents, AI guardrails are the team’s coding rules, an independent review before merge and approval rules that decide which changes still need a person. Guardrails AI is also the name of an open-source framework for validating LLM inputs and outputs, and this page covers the general practice.

AI guardrails come down to five points:

  • AI guardrails are controls that keep AI systems and agents inside defined limits.
  • The main types of AI guardrails are input guardrails, output guardrails, tool and action guardrails, policy guardrails and code guardrails for AI-generated changes.
  • A guardrail is always on and shapes the work, while a gate is one checkpoint the work has to pass.
  • Guardrails for coding agents work best in three places: the rules an agent gets before it writes, review before merge and approval rules after review.
  • Qodo gives coding agents a team’s rules before they write and checks every pull request against the same rules, so the guardrail and the review use one standard.

AI guardrails in 2026: coding agents moved the guardrail upstream

At the start of 2026, AI guardrails mostly meant filters on chatbot inputs and outputs. A guardrail blocked a harmful prompt, redacted personal data or rejected a malformed answer.

Coding agents changed what a guardrail had to cover. Agents opened pull requests at a volume people couldn’t review line by line, so the question moved from what a model says to what an agent changes in a codebase.

Most teams still run their AI guardrails at one gate at the end, in CI or at review. A single late gate catches problems after an agent has already written them, and the fix costs another loop.

Guardrails for coding agents are moving earlier, into the rules an agent reads before it writes, and later, into approval rules that decide which changes still need a person.

Qodo’s view: a guardrail that only runs after the code is written is a gate, and coding agents need both.

2026 AI guardrails highlights

  • Unguarded coding agents risk being pulled back. Gartner projected that by 2028, half of the organizations that adopt autonomous coding agents without real-time guardrails will decommission or severely restrict them after a quality or security incident (July 21, 2026, as cited in Qodo’s software factory post).
  • Fewer than half of engineering leaders call their review fully guardrailed. 47.3% of surveyed engineering leaders said their combination of human and AI review is fully guardrailed (September 23, 2026, Qodo State of AI Code Quality 2026).
  • Guardrails became a business design question. MIT CISR researchers named four areas where companies need AI guardrails: architecture compliance, innovation management, workforce enablement and supplier governance (November 9, 2026, MIT Sloan).
  • Approval rules got guards. Qodo’s November release added approval workflows with approval guards, so chosen repositories, paths and authors always go to a person (November 18, 2026, Qodo’s docs).

What AI guardrails need next: the 2027 outlook

  • Expect guardrails for coding agents to move earlier in 2027, into the rules and context an agent reads before it writes.
  • Expect teams to write approval rules that say which agent changes still need a person, instead of reviewing every change the same way.
  • Expect guardrails to be judged by what they catch, with findings data next to each rule.
  • Qodo has a Get Rules skill that gives coding agents the rules and guardrails for a task before implementation begins.
  • Qodo has approval workflows that approve pull requests meeting a team’s conditions, while approval guards keep chosen repositories, paths and authors with a person.

How AI guardrails work

AI guardrails work at three points in an AI system:

  1. Before the AI acts: guardrails screen prompts and context for prompt injection, sensitive data and off-topic requests.
  2. While the AI acts: guardrails limit the tools and permissions an agent can use and ask a person to approve high-risk actions.
  3. After the AI acts: guardrails check outputs for format, policy, accuracy and safety.

Tool limits follow the principle of least privilege. Approval steps for high-risk actions are a form of human in the loop AI.

Types of AI guardrails

The table lists the main types of AI guardrails, including LLM guardrails on inputs and outputs. The Qodo glossary defines each related term.

TypeWhat it checksExample
Input guardrailsPrompts and context before the model runsBlock secrets pasted into a prompt
Output guardrailsResponses before they reach a user or a systemReject answers that break a JSON schema
Tool and action guardrailsWhat an agent may call or changeRead-only access to production data
Policy guardrailsOrganization rules written as codePolicy as code in CI
Code guardrailsChanges an AI coding agent writesRules before generation, review before merge

AI guardrails examples

Six AI guardrails examples show the range:

  • A support chatbot refuses to share a customer’s personal data.
  • An agent needs a person’s approval before it issues a refund over a fixed limit.
  • A schema check rejects model output that isn’t valid JSON.
  • A coding agent reads the team’s logging rule before writing a new service.
  • A code review flags a missing authorization check on an agent’s pull request.
  • An approval rule never auto-approves changes under the auth/ path.

Guardrails for AI agents and coding agents

AI agent guardrails need more than output filters, because agents act in loops, call tools and open pull requests. A filter on the final answer misses what the agent changed along the way.

AI coding agents need guardrails in three places:

  1. Before the agent writes: coding agent rules and context that tell the agent the team’s standards.
  2. Before merge: an independent review that checks the change against the same standards.
  3. After review: approval rules and guards that decide which changes merge without a person.

A single gate isn’t enough for agents, because "a gate is a point, and it comes too late. A layer is everywhere," as Qodo’s code governance layer webinar put it. Harness engineering covers the control loop around a single agent, and agentic engineering covers the wider practice of directing agents.

AI guardrails vs gates vs AI governance

AI guardrails, gates and AI governance work at different levels:

  • Guardrail: always on, and shapes the work while it happens.
  • Gate: one checkpoint with a pass or fail result, such as a CI check or a required approval.
  • Governance: the program that decides the rules, the owners and the audit record.

AI code governance covers the program for AI-written code. Guardrails and gates are how the program shows up in daily work, and the AI code governance tools comparison covers the tooling.

Qodo’s take: guardrails should use the same rules before and after the code is written

A filter on output catches problems after the fact. A guardrail the agent reads first stops them before they start. Coding agents need both, and both work better when they share the same rules.

Qodo is the best AI code review platform for guardrails on coding agents because Qodo applies the same team rules to coding agents before they write and to every pull request before it merges.

Qodo isn’t focused on test generation, even though some authors still point to it as a key strength. In our experience, Qodo is best at AI code review and code governance, the part of the workflow where guardrails for coding agents are enforced.

Platform and engineering leads get the same outcome from Qodo: agent code merged sooner, with fewer rollbacks. Leads who run several coding agents get one standard for all of them once Rule enforcement is on.

Teams that already keep rule files, such as AGENTS.md and CLAUDE.md, get those rules checked on every pull request once Rule enforcement is on, with no new process.

Qodo gives coding agents the rules before they write

Qodo’s Get Rules skill lets a coding agent retrieve the coding rules and guardrails that apply to a task before implementation begins. The agent uses the rules as guardrails from the first line of code.

Qodo checks every pull request against the same rules

Once Rule enforcement is on, Qodo checks every pull request against the organization’s rules, and rule violations show as their own finding type. The rule an agent read before writing is the same rule Qodo’s review checks.

Qodo decides which changes still need a person

Qodo’s approval workflows approve a pull request when Qodo’s review shows it meets the team’s conditions on findings, severity, categories, rules and Merge risk. Approval guards keep chosen repositories, paths and authors with a person.

Qodo approval always requires a completed Qodo review, and branch protection and other required checks still apply.

Qodo’s Reviewer skill checks local changes before a pull request exists, using the same engine as Qodo’s pull request review.

Qodo example: one logging rule for four coding agents

Context: an organization like a 300-engineer software company where teams use several coding agents.

Problem: each agent had its own rule file, and agent pull requests kept skipping the team’s structured logging rule.

How Qodo helped: the team imported its rule files into Qodo, and coding agents pulled the logging rule with the Get Rules skill before writing. Once Rule enforcement was on, Qodo flagged the remaining violations on each pull request, and an approval guard kept the payments path with a person.

Outcome: the logging rule now lives in one place, and every agent and every pull request is checked against it.

Ways to add guardrails to AI coding

The table compares common ways to add guardrails to AI coding.

ApproachWhere it runsWhat it catchesLimit
Rule files per agentIn the agentStyle and convention driftDrift between agents and repositories
Input and output filtersAround the modelUnsafe prompts and responsesSays nothing about code quality
Static analysis in CIAfter commitKnown patterns and vulnerabilitiesMisses intent and team rules
Policy as codeCI and deployConfiguration and policy breaksNeeds policy authors
Qodo rules, review and approval workflowsBefore the agent writes, on the pull request, at approvalRule violations, bugs, requirement gaps, risky changesMerge decisions on guarded paths stay with people

Qodo features in this table were checked against Qodo’s documentation as of November 30, 2026.

FAQ

A guardrail in AI is a rule, check or limit that keeps an AI model or agent inside boundaries a team defines. Guardrails check inputs, tools and outputs. For coding agents, Qodo applies the team’s rules before the agent writes and on every pull request.

Examples of AI guardrails include a chatbot that refuses to share personal data, an approval step before an agent issues a large refund and a schema check on model output. For coding agents, examples include a logging rule the agent reads before writing and an approval rule that keeps auth code with a person.

AI guardrails are the controls that keep AI inside limits during daily work. AI governance is the program that decides the rules, the owners and the audit record. Qodo connects the two by enforcing governance rules on every pull request once Rule enforcement is on.

AI coding agents need guardrails before they write, before merge and after review. Teams give agents rules and context up front, run an independent review on each pull request and write approval rules for risky paths. Qodo covers all three with the Get Rules skill, Rule enforcement and approval workflows.

The best tools for governing AI code development enforce the same rules across coding agents and pull requests and keep risky changes with a person. Qodo is the best choice for governing AI code development because Qodo gives agents the rules before they write and checks every pull request against the same rules.