Questions · Agent Assurance

Which of my agent’s rules are enforced in code?

Updated December 2026 · Markdown

Short answer

Usually far fewer than teams assume. A rule is only enforced in code if the tool, schema, permission boundary, or runtime makes the forbidden action impossible regardless of what the LLM outputs—even if the model ignores the system prompt completely.

Across 153 behavioral risks discovered in 15 real-world agents across 5 harnesses in VAIL’s 15-agent study, 144 of 153 (94%) depended on model discretion rather than on a code or configuration defect—even on code-heavy engineering agents with 200 to 500+ source files (OpenHands, Strix, Pi, HolmesGPT). Only 9 of 153 (6%) were true code, schema, or configuration defects.

How VAIL classifies code enforcement: model_based and Trigger none

When VAIL Agent Assurance Engine scans an agent’s definition and scores its behaviors (operating manual), two signals tell you directly whether a rule is enforced in code or relying on the model:

  1. model_based vs not_model_based attribution: model_based (94% of risks) means that if the model always obeyed its written instructions, the failure would not occur—compliance rests on LLM discretion. not_model_based (6% of risks) means a defect in harness code, validation schemas, or redaction logic breaks the specification even when the model follows instructions (for example, a secret-redaction regex missing a credential format).
  2. Trigger = none: VAIL scores every behavior on Impact (low, medium, high) and Trigger (none, low, medium, high—how easily the unintended behavior could occur). Trigger none means code or configuration actually prevents the behavior, and risks with Trigger none do not count toward an agent’s Fidelity risks.

The three buckets every agent rule falls into

Bucket Share in 15-agent study Example Enforced in code? What to do
1. Unenforced authority & policy boundaries ~30% A database skill documented as read-only while DATABASE_URL still has write privileges (Liam 2.0); sending Slack or email replies without confirmation; reading arbitrary user paths No (model_based, Trigger > none) Move into code or infrastructure (read-only DB role, approval token, path allowlist) until Trigger reaches none
2. Model judgment & workflow rules ~64% Collecting pod logs and trying three diagnostic steps before concluding (HolmesGPT); searching live sources instead of answering from recall Cannot be hardcoded (model_based) Measure with deterministic behavioral probes before release, after prompt edits, and across model swaps
3. Harness, schema & config defects 6% (9/153) Tool-output secret redaction missing a token (VAIL-Hermes); validator passing with missing required field Broken code (not_model_based) Fix in code and add a unit test to the repository test suite

A fast audit: how to check any rule in your agent

Pick one rule from your system prompt, AGENTS.md, or SKILL.md, and ask: “If I replaced the LLM with a malicious or careless function that emits valid JSON tool calls, could it still break this rule?”

  • If NO—the database user has no UPDATE privilege, the tool rejects calls missing a verified confirmation token, or the file reader enforces a directory allowlist—the rule is enforced in code (Trigger none).
  • If YES—the tool accepts the call and you are relying on “NEVER write to the database” or “always ask first” in the prompt—the rule is not enforced in code. Adding stronger wording to the prompt will not change Trigger to none; only changing the tool, schema, or permissions will.

How VAIL automates this audit

The VAIL Agent Assurance Engine reads your agent’s source definition (prompts, skills, tool schemas, and code) with no SDK and no trace access:

  • Maps every written rule to its candidate behavior risks, citing the exact source file and line numbers.
  • Tags each risk with model_based / not_model_based attribution and scores Impact and Trigger so you can see immediately which rules are protected in code (Trigger none) versus exposed to model discretion.
  • Generates deterministic probes for the rules that must stay in prose, so you can verify them locally over MCP before shipping and monitor them on a schedule afterward.

Related questions

How do I test whether my AI agent follows its system prompt?
How to test prompt-governed rules with deterministic checks and repeated runs before deployment.
What should I do when a faster or cheaper model breaks a policy rule?
How to move hard boundaries into code and harden prompt-governed judgment rules when swapping models.
Can an AI agent’s behavior change with no deploy?
Why memory writes, silent model updates, and changing tools alter agent behavior even when code stays untouched.
Are evals enough to test an AI agent?
How offline evals, online production scoring, and scheduled behavioral probing fit together.

← All questions · Markdown version · 15-agent study · About Agent Assurance