Guard AI agents with Agent Guardrails

Create a guardrails model that catches risky AI agent actions, like force pushes or dropping tables, then use it in a policy.

DM
Danish Mir
Written By Danish MirLast updated 6 days ago

Agent Guardrails check what AI coding agents do on a device, such as running rm -rf, force pushing or dropping a database table. It works in two parts:

  1. A guardrails model defines which actions are risky.
  2. An Agent Guardrail rule in a policy decides who the model applies to and what happens on a match.

You need a deployed guardrails model before you can add the rule. Agent Guardrails is only available on some plans. New to policies? Start with Policies overview.

Part 1: Create a guardrails model

  1. Go to Security → Agent Guardrails and click Create Guardrails Model.
  2. Enter a name and choose a template. You can change every rule afterwards.

    • Safe Coding Agent: destructive git, filesystem and database commands.
    • Start from scratch: an empty model with no rules switched on.
  3. Click Create Draft.
Create Guardrails Model

Built-in detectors

The Deterministic tab lists built-in detectors grouped by category:

  • Git: force push, hard reset, branch deletion.
  • Filesystem: recursive delete, permission changes on system paths.
  • Database: drop database or table, truncate or delete without a WHERE clause.
  • Cloud infrastructure: terraform destroy, kubectl delete and similar.

Each one has a severity. Use the switch to turn it on or off.

Built-in detectors

Custom rules

Click Add Custom Rule and pick a rule type:

  • Keywords: commands or phrases, one per line. Matching ignores case.
  • Regular expression: a pattern. Inline flags like (?i) work. Lookarounds and backreferences are not supported.
  • Protected paths: file paths agents must not touch, one glob per line. For example **/.env or ~/.ssh/**.

Give each rule a name and a severity: Low, Medium, High or Critical.

Protected paths rule

Dynamic rules

The Dynamic tab catches risky behaviour that no pattern can describe. Click Add Dynamic Rule and describe it in plain language. For example: "The agent is trying to delete or overwrite data in a production database". Pick a Sensitivity: Strict, Balanced (recommended) or Relaxed. The sensitivity options are explained in Protect sensitive data with DLP.

Deploy the model

A new model is a draft and policies can't use it yet. Click Deploy in the draft banner, or in the options menu at the top right.

When you edit a deployed model, your changes are saved as a draft. Policies keep using the active version until you deploy the draft. You can't delete a model while a policy uses it.

Part 2: Add an Agent Guardrail rule to a policy

  1. Go to Security → Policies and open a policy, or click Create Policy.
  2. Click Add rule and choose Agent Guardrail.
  3. Pick the model, choose which detection rules to apply, and set the enforcement.
  4. Click Add rule, then Save and Deploy.
Agent Guardrail rule

Field

What it does

Model

A deployed guardrails model. The rule always uses the model's active version.

Detection Rules

All rules, Selected rules, or Minimum severity. With Selected rules, tick the built-in detectors, custom rules and dynamic rules to apply.

Enforcement

Block, Warn or Watch.

If no model is deployed yet, the rule shows No deployed guardrails models. Click Go to Agent Guardrails and deploy one first.

No deployed guardrails models

There is one enforcement per rule. To treat some detectors differently, add a second Agent Guardrail rule with a narrower match. If several rules match the same action, the strictest wins: Block, then Warn, then Watch.

Need help?

Contact support@getalesia.com.

Was this helpful?

Your feedback shapes what we write next.