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

# Compliance Rules

> Create custom compliance rules that check every agent in your workspace automatically whenever it is edited, with severity levels and per-rule analytics.

<Frame>
  <img src="https://mintcdn.com/langdock-34/mF-j7uDMIKjkocSh/images/governance_compliance_rules0.png?fit=max&auto=format&n=mF-j7uDMIKjkocSh&q=85&s=0d6107c8172879a794077aa656a304af" alt="Compliance rule for prohibited AI practices under the EU AI Act with Critical severity and Enabled status" style={{borderRadius: '6px'}} width="2182" height="318" data-path="images/governance_compliance_rules0.png" />
</Frame>

Compliance rules turn your internal policies into automated checks. Instead of manually reviewing every agent against your guidelines, you define a rule once and Governance checks every agent against it automatically. The results appear directly in each agent's compliance checks, so you immediately see which agents meet your standards and which need attention.

## How rules work

Every compliance rule is a binary check: an agent either passes or fails. There is no partial compliance, which keeps results unambiguous and easy to act on.

Rules run automatically when an agent is created and whenever a new agent version is published. This means compliance is enforced continuously: an agent that passed yesterday is checked again as soon as its next version goes live. You can also rerun a rule manually on existing agents at any time, for example after adjusting its failure condition.

When an agent fails a rule, the failure appears in the agent's compliance checks in the [agent detail view](/en/admin/governance/agents#the-agent-detail-view), together with the rule's severity. From there you can decide whether to [flag or disable the agent](/en/admin/governance/agents#take-action-on-an-agent).

## Create a rule

You can create a rule from scratch or start from a template.

<Steps>
  <Step title="Open Compliance rules">
    Go to **Compliance rules** in Governance and click **New rule**. Pick one of the compliance templates as a starting point, or choose **Start from scratch**.

    <Frame>
      <img src="https://mintcdn.com/langdock-34/mF-j7uDMIKjkocSh/images/governance_compliance_rules1.png?fit=max&auto=format&n=mF-j7uDMIKjkocSh&q=85&s=bde8b07af0ebea57e70143cc6a0cef85" alt="Template picker for new compliance rules with Start from scratch and pre-written templates like EU AI Act and GDPR" style={{borderRadius: '6px'}} width="2204" height="1196" data-path="images/governance_compliance_rules1.png" />
    </Frame>
  </Step>

  <Step title="Describe the rule">
    Give the rule a name and a description. A clear description helps other admins understand what the rule enforces and why.

    <Frame>
      <img src="https://mintcdn.com/langdock-34/mF-j7uDMIKjkocSh/images/governance_compliance_rules2.png?fit=max&auto=format&n=mF-j7uDMIKjkocSh&q=85&s=b06b7bb1578841dc1de44baab7318b7d" alt="New compliance rule dialog with name and description fields" style={{borderRadius: '6px'}} width="2202" height="938" data-path="images/governance_compliance_rules2.png" />
    </Frame>
  </Step>

  <Step title="Set the severity">
    Choose how serious a failure of this rule is: **Low**, **Medium**, **High**, or **Critical**. Severity helps you prioritize which failing agents to review first.

    <Frame>
      <img src="https://mintcdn.com/langdock-34/mF-j7uDMIKjkocSh/images/governance_compliance_rules3.png?fit=max&auto=format&n=mF-j7uDMIKjkocSh&q=85&s=5ac69d701d3e2863d84127d5cf334ba5" alt="Severity selector with the options Low, Medium, High, and Critical" style={{borderRadius: '6px'}} width="2204" height="428" data-path="images/governance_compliance_rules3.png" />
    </Frame>
  </Step>

  <Step title="Define the failure condition">
    Define the condition under which an agent fails the rule. This is the rule set the check evaluates each agent against.

    <Frame>
      <img src="https://mintcdn.com/langdock-34/mF-j7uDMIKjkocSh/images/governance_compliance_rules4.png?fit=max&auto=format&n=mF-j7uDMIKjkocSh&q=85&s=fd977bad692b5c92e7fa6b5cde5294f0" alt="Failure condition field with an example rule that fails agents exposing personal data" style={{borderRadius: '6px'}} width="2202" height="904" data-path="images/governance_compliance_rules4.png" />
    </Frame>
  </Step>

  <Step title="Run it on existing agents">
    Optionally, select **Check existing agents now** to run the rule against all existing agents right after creating it. Otherwise, agents are checked when their next version is published.

    <Frame>
      <img src="https://mintcdn.com/langdock-34/mF-j7uDMIKjkocSh/images/governance_compliance_rules5.png?fit=max&auto=format&n=mF-j7uDMIKjkocSh&q=85&s=e7c22416ae29b6d7d540b2be0c6ece36" alt="Check existing agents now toggle that runs the rule against all existing agents right after creation" style={{borderRadius: '6px'}} width="2200" height="470" data-path="images/governance_compliance_rules5.png" />
    </Frame>
  </Step>
</Steps>

<Tip>
  Match the severity to the action you would take. If a failure would make you disable an agent immediately, the rule is **Critical**. If it is something you would mention to the editor at the next review, **Low** or **Medium** is appropriate.
</Tip>

## Rule analytics

Each rule has its own analytics view that shows how the rule behaves over time:

* **Rule runs over time**: how often the rule was executed and how many agents were checked.
* **Flagged agents over time**: how many agents failed the rule, so you can see whether compliance in your workspace is improving.
* **Rule cost over time**: what running the rule costs.

<Note>
  API costs for rule executions are shown for transparency. They are currently not billed to your workspace and do not count toward user usage limits.
</Note>
