Back to all articles
Engineering Blog7 min readAugust 17, 2026

Runtime Policy Enforcement in AI Agents: Stopping Unsafe Actions in Real Time

SG
Security & Governance Team
Agentis Infrastructure
"Enforcement isn't just about writing rules—it's about stopping unsafe actions in real time, before the damage is already done."

The Limitations of Post-Hoc Observability

Traditional observability is reactive. An alert triggers after an agent sends an unverified refund, accesses sensitive health records, or calls an unapproved database tool. In mission-critical workflows, discovering an issue 15 minutes after execution is too late.

3-Tier Guardrail Architecture

Agentis provides active runtime interception: - **Tier 1: Explicit Annotations**: Decorate agent tools with strict preconditions (`@govern`, `guardrail_span`). - **Tier 2: Provider-Native Signals**: Automatically parse safety categories from OpenAI, Anthropic, and Google Gemini API responses. - **Tier 3: Heuristic & PII Checks**: Zero-latency local regex and pattern matching to intercept credit cards, SSNs, and restricted commands before network egress.

Soft vs Hard Blocks

| Policy Mode | Trigger Behavior | Incident Handling | | :--- | :--- | :--- | | **Soft Block** | Logs warning to dashboard; execution proceeds | Generates non-blocking audit flag | | **Hard Block** | Raises runtime exception; execution halts immediately | Prevents data corruption or monetary loss |


import { agentis } from "agentis";

// Enforce max tool calls per task agentis.registerPolicy({ name: "max_tool_invocations", scope: "agent", rule: (span) => span.toolCalls.length <= 10, action: "hard_block" });

Ready to monitor your agents?

Get started with Agentis in under 3 minutes with zero-configuration OpenTelemetry tracing.

Get Started Free