Skip to content

Guardrails

View as Markdown

These guides check what an agent's turn did before its answer is kept, and choose what happens when a check fails.

A guardrail is a rule an agent's turn must satisfy. It's a check and an action. The check is a function over the turn: its answer, its tool calls and their results. The action is what happens when the check fails. Kindgi runs an agent's guardrails once per turn, on its final answer, before the answer is stored.

  • Write a guardrail: the check, the declaration, and wiring it onto an agent.
  • Configure a guardrail: settings the check runs with, and their schema.
  • Stop a turn or record a violation: halt versus log-only, severity, which agents a guardrail covers, and how a guardrail is doing: how often it passed, was violated, blocked a turn or couldn't run.
  • Use a built-in check: name one of Kindgi's seven checks instead of writing your own, and the settings each reads.

The examples use the quickstarts' pack, my-pack, whose agent answers with dev-echo until you connect a model.