Skip to main content

Guard Check Types

A guard is made up of one or more checks. Each check inspects content and, if it matches, contributes a score. The guard combines its checks into a single score out of 10 and fires when that score reaches the guard's threshold. You manage checks on the Checks tab of the guard editor.

A guard row showing its check count, threshold, and action

Common fields

Every check, regardless of type, has:

FieldDescription
NameA label for the check, shown in the checks list and in results
TypeOne of the five types below
CertaintyThe score this check contributes when it matches, on a 0-10 scale (for example, 10/10)
Enabled toggleTurns the individual check on or off without removing it

After editing checks you must select Save Checks for the changes to take effect.

The five types

TypeWhat it doesKey configuration
Built-inUses one of Willow's managed detectors (secrets, PII, prompt injection, and so on) that run locallySelect the detector; no expression to write
RegexMatches content against a regular expressionThe pattern
JSONataEvaluates a JSONata expression against structured payloads, for matching on specific fields or shapesThe expression
LLMSends the content to your connected model with a detection prompt and interprets the model's judgmentThe prompt
FunctionRuns custom logic for cases the other types cannot expressThe function body

Built-in

Built-in checks wrap Willow's own detectors, the same engines behind the built-in guards. They run on your infrastructure with no external API calls. Use them when a managed detector already covers what you need, such as API keys, credit card numbers, or SSNs.

Regex

A Regex check matches content against a pattern. Regex checks are deterministic: content that matches typically scores at the check's certainty (often 10/10), and content that does not match scores 0. They are ideal for well-defined formats like email addresses, IP addresses, or a specific token shape.

JSONata

A JSONata check evaluates an expression against the structured tool payload rather than raw text. Use it to match on a particular field, a nested value, or the shape of an argument, for example flagging a call only when a specific parameter is present.

LLM

An LLM check describes what to detect in natural language and lets your connected model judge the content. The editor provides a Name, a certainty score, and an LLM Prompt. Use LLM checks for fuzzy or context-dependent risks that a pattern cannot capture, such as "content that describes how to exfiltrate data."

LLM checks call your configured AI provider. They require Bring Your Own AI to be enabled under Settings › AI Settings.

Function

A Function check runs custom code against the content, for logic that none of the other types express cleanly. Use it as an escape hatch when you need bespoke matching.

How checks combine

The guard evaluates each enabled check against the content. The guard's overall score is the highest check score, so a single strong match is enough to reach the threshold. Each matched check appears in the result with its own score, which the Playground shows in the per-check breakdown.

For example, an Email Address Detection guard with two checks (Email Address and Mailto Link) scoring 10 and 0 on the input mail@example.com produces a guard score of 10/10, which meets an 8/10 threshold and fires.

Add Check with AI

Instead of writing a check by hand, select Add with AI on the Checks tab. The modal asks what the check should detect and offers a Check Type dropdown:

Add Check with AI modal with a description field, a Check Type dropdown set to Auto (let AI decide), and a Generate Check button
  • Auto (let AI decide) lets Willow pick the most suitable type.
  • Choosing Regex, LLM, JSONata, or Function constrains the generated check to that type.

Select Generate Check and Willow creates a check from your description. It appears in the checks list, where you can refine its fields and certainty before saving.

Add with AI is only available once Bring Your Own AI is configured under Settings › AI Settings. Without a connected AI provider the option does not appear, and you add checks manually instead. The same applies to LLM checks, which call your provider each time they run.