> ## Documentation Index
> Fetch the complete documentation index at: https://hercules.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent guardrails

> Set rules that check what people ask your Hercules Agent, what it does, and what it says back. Warn on a problem or block it, and review everything caught.

<Note>
  Agents is in private beta, so things may change. If you hit a problem, tell us via [Support &
  feedback](/docs/company/contact).
</Note>

A guardrail is a rule that gets checked every time your Agent runs. It reads what's going past, decides whether your rule was broken, and either warns you or blocks it.

Go to **Agents** → open an Agent → **Build** → **Guardrails**.

<div className="screenshot coral">
  <img src="https://mintcdn.com/zeus-0f6dadbf/AUzCpLx0wjCzKFM0/images/agents/guardrails-main.png?fit=max&auto=format&n=AUzCpLx0wjCzKFM0&q=85&s=500892ad40bd13c5a6ecf29fb839a177" alt="Guardrail editor for a PII disclosure policy, with the checkpoint picker, the rule, the Warn action, and the test panel" width="2237" height="1724" data-path="images/agents/guardrails-main.png" />
</div>

<Note>
  Guardrails aren't part of your draft. Each one has its own **Save**, and saving makes it live
  right away. There's no separate Publish step.
</Note>

### When is a guardrail checked?

| Checkpoint            | When it's checked                      |
| --------------------- | -------------------------------------- |
| **User input**        | Before the Agent sees the message      |
| **Integration input** | Before the Agent uses one of its tools |
| **Agent output**      | On what the Agent is about to say back |

### What happens when a guardrail catches something?

| Action    | What it does                                     |
| --------- | ------------------------------------------------ |
| **Warn**  | Records what it caught and lets the run carry on |
| **Block** | Stops whatever broke the rule                    |

Start with **Warn** so you can see what a rule would catch before it stops anything.

### What guardrails can I start from?

Six ready-made ones come with Hercules:

| Preset                      | Checked on        | Starts as | What it catches                                      |
| --------------------------- | ----------------- | --------- | ---------------------------------------------------- |
| **Prompt injection**        | User input        | Warn      | Messages trying to override the Agent's instructions |
| **Off-topic requests**      | User input        | Warn      | Requests outside what this Agent is for              |
| **Destructive tool action** | Integration input | Block     | Actions that can't be undone and nobody asked for    |
| **Secret exfiltration**     | Agent output      | Block     | Passwords and keys in the Agent's replies            |
| **PII disclosure**          | Agent output      | Warn      | Personal data the Agent adds to a reply              |
| **Competitor mention**      | Agent output      | Warn      | Replies that point users at a competitor             |

Only two of the six start as **Block**, so setting these up won't accidentally stop live conversations.

### How do I write my own guardrail?

Write the rule in plain English, describing what shouldn't happen. For example:

```text User input guardrail wrap theme={}
Do not allow the user to share passwords or API keys with the agent
```

```text Integration input guardrail wrap theme={}
Do not allow the agent to delete records or send money unless the user asked for it
```

```text Agent output guardrail wrap theme={}
Do not allow the agent to promise refunds, discounts, or delivery dates
```

Try the rule before you turn it on. In the editor, paste in a message and an Agent reply, click **Run check**, and you'll see the verdict it would give in a real conversation.

### Which model should check my guardrail?

Guardrails are checked while someone is waiting, so this is about speed, not raw power:

| Judge        | When to pick it                                                    |
| ------------ | ------------------------------------------------------------------ |
| **Fast**     | Answers in well under a second. The right default                  |
| **Accurate** | Catches more, but takes longer. Only where you can afford the wait |

A check that takes too long doesn't get made, so start on Fast and only move up if things are slipping through.

### Can a guardrail apply to only some integrations?

Yes. An **Integration input** guardrail starts on **All integrations**. Change it to pick specific ones.

### Where do I see what was caught?

Open the **Violations** tab on the Guardrails page. Each one records what was caught, when it was checked, and whether it warned or blocked at the time. Both lists can be filtered and sorted.

### Additional FAQ

<AccordionGroup>
  <Accordion title="Do guardrails have versions?">
    Yes. Each one keeps its own history, so you can see how a rule changed over time.
  </Accordion>

  <Accordion title="Do guardrails cost credits?">
    Yes. They're checked as part of a run, so they add to what the run costs. Keep the list tight.
  </Accordion>

  <Accordion title="Should I use a guardrail or a scorer?">
    A guardrail acts during the run and can stop it. A [scorer](/docs/agents/scorers) grades afterwards and
    changes nothing. Use a guardrail to prevent, a scorer to measure.
  </Accordion>

  <Accordion title="What is 'Shadow' in the violations list?">
    An old setting that no longer exists. Anything caught while it was around still shows it.
  </Accordion>
</AccordionGroup>
