← All frameworks
Dashboard

Guardrails AI

Check the answer before the customer sees it.

Guardrails

A Guard wraps a model call with validators. Each one checks the reply against a rule, and on_fail decides what happens when it does not pass: let it through, repair it, refuse, or ask the model again. It also turns a Pydantic model into a schema the answer must match.

Reach for it when

  • You need the reply checked before it leaves your system
  • You want structured output that is validated, not hoped for
  • You need a record of what was checked and what failed

Look elsewhere when

  • You want to score answers for quality. That is an eval
  • You want policy over tool calls rather than text. Look at the Agent Governance Toolkit

What the lessons will cover

  1. 01A Guard and its first validator
  2. 02Reading what the Guard did
  3. 03on_fail actions
  4. 04Writing your own validator
  5. 05A stand-in model
  6. 06Input guards
  7. 07Guards from a Pydantic model
  8. 08Reask and repair
  9. 09AsyncGuard
  10. 10A guarded support desk

Others in guardrails

Common questions

Is Guardrails AI free to use?

Guardrails AI is open source and free to run yourself. You still pay whichever model provider you point it at, and this tutorial is free with no signup.

Do I need to know Python to use Guardrails AI?

Basic Python is enough. Functions, dictionaries and imports cover most of what Guardrails AI asks of you.

When should I not use Guardrails AI?

You want to score answers for quality. That is an eval. You want policy over tool calls rather than text. Look at the Agent Governance Toolkit.

Lessons for Guardrails AI are being written. Meanwhile the Agent Governance Toolkit tutorial covers the same ground: state, tools, loops, memory and human approval. Most of it carries straight over.

Start the Agent Governance Toolkit tutorial →