# Runtime Guardrail

## Overview

Runtime Guardrail applies controls to an agent in production. It uses the findings from evaluations to decide where controls are needed.

Many guardrails check only the user's input and the agent's final reply. Agents often fail between those two points: a tool returns content that contains instructions, or the agent passes sensitive data to a tool that sends it outside your organization. Runtime Guardrail also inspects tool calls and tool results.

<figure style="margin:1.5rem 0">
<svg viewBox="0 0 880 330" width="100%" role="img" aria-labelledby="aig-rg-title aig-rg-desc" style="max-width:880px;height:auto;font-family:var(--body)">
<title id="aig-rg-title">Where Runtime Guardrail inspects an agent</title>
<desc id="aig-rg-desc">A request flows to the agent, the agent calls tools and data stores and receives results, and a reply flows back. Runtime Guardrail wraps the agent and inspects four moments: the request, each tool call, each tool result, and the reply. At each moment it can allow, monitor, sanitize, redact, block, or require approval.</desc>
<marker id="aig-rg-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" style="fill:var(--accent)"/></marker>
<rect x="20" y="95" width="130" height="70" rx="10" style="fill:var(--panel);stroke:var(--line)"/>
<text x="85" y="126" text-anchor="middle" style="fill:var(--ink);font-size:15px;font-weight:700">Requester</text>
<text x="85" y="146" text-anchor="middle" style="fill:var(--muted);font-size:12px">User or system</text>
<rect x="230" y="30" width="420" height="200" rx="14" style="fill:var(--accent-tint);stroke:var(--accent);stroke-width:1.5"/>
<text x="250" y="56" style="fill:var(--ink);font-size:15px;font-weight:700">Runtime Guardrail</text>
<rect x="340" y="85" width="200" height="90" rx="10" style="fill:var(--panel);stroke:var(--line)"/>
<text x="440" y="124" text-anchor="middle" style="fill:var(--ink);font-size:16px;font-weight:700">Your agent</text>
<text x="440" y="146" text-anchor="middle" style="fill:var(--muted);font-size:12px">No prompt changes</text>
<rect x="730" y="85" width="130" height="90" rx="10" style="fill:var(--panel);stroke:var(--line)"/>
<text x="795" y="126" text-anchor="middle" style="fill:var(--ink);font-size:15px;font-weight:700">Tools</text>
<text x="795" y="146" text-anchor="middle" style="fill:var(--muted);font-size:12px">and data stores</text>
<path d="M150 115H338" style="fill:none;stroke:var(--accent);stroke-width:1.5" marker-end="url(#aig-rg-arrow)"/>
<path d="M338 148H152" style="fill:none;stroke:var(--accent);stroke-width:1.5" marker-end="url(#aig-rg-arrow)"/>
<path d="M540 108H728" style="fill:none;stroke:var(--accent);stroke-width:1.5" marker-end="url(#aig-rg-arrow)"/>
<path d="M730 152H542" style="fill:none;stroke:var(--accent);stroke-width:1.5" marker-end="url(#aig-rg-arrow)"/>
<circle cx="245" cy="115" r="13" style="fill:var(--accent)"/>
<text x="245" y="120" text-anchor="middle" style="fill:var(--panel);font-size:13px;font-weight:700">1</text>
<circle cx="635" cy="108" r="13" style="fill:var(--accent)"/>
<text x="635" y="113" text-anchor="middle" style="fill:var(--panel);font-size:13px;font-weight:700">2</text>
<circle cx="635" cy="152" r="13" style="fill:var(--accent)"/>
<text x="635" y="157" text-anchor="middle" style="fill:var(--panel);font-size:13px;font-weight:700">3</text>
<circle cx="245" cy="148" r="13" style="fill:var(--accent)"/>
<text x="245" y="153" text-anchor="middle" style="fill:var(--panel);font-size:13px;font-weight:700">4</text>
<text x="20" y="272" style="fill:var(--ink);font-size:13px;font-weight:700">Inspection points</text>
<text x="20" y="296" style="fill:var(--muted);font-size:13px">1 The request</text>
<text x="230" y="296" style="fill:var(--muted);font-size:13px">2 Each tool call</text>
<text x="450" y="296" style="fill:var(--muted);font-size:13px">3 Each tool result</text>
<text x="680" y="296" style="fill:var(--muted);font-size:13px">4 The reply</text>
</svg>
</figure>

## How enforcement works

Runtime Guardrail wraps the agent and inspects four points: the request, each tool call, each tool result, and the reply. It does not change your prompts. Each inspection is recorded as a span in your traces.

Runtime Guardrail uses the agent's attack surface to make decisions. It knows which inputs are untrusted, which data is sensitive, which tools can send data out, and what each requester is allowed to do. For example, it can allow an agent to email an order confirmation and stop the same agent from emailing a customer list because a free-text field told it to.

## Mitigation options

Each finding from an evaluation has mitigation options. Select one for each finding:

| Mitigation | Effect | Use when |
|---|---|---|
| **Monitor only** | Logs each detection and allows the call | You want to observe before you enforce |
| **Sanitize instructions** | Removes instructions from untrusted text before the model reads it. The run completes | The agent must read untrusted content |
| **Redact sensitive data** | Replaces sensitive data with placeholders. The call runs | The action is acceptable but the data is not |
| **Require approval** | Holds the call until a person approves it | A person must review high-impact actions |
| **Block the call** | Stops the call | The action must not happen. This option can also stop legitimate work |

## Test a mitigation before you enable it

Relyance replays each mitigation option in the sandbox. It uses the security tests for that finding and the related normal tasks. The result shows how many attacks still succeed and how many tasks still complete, so you can compare the options before you enable one.

## Approvals

When a mitigation is set to **Require approval**, Runtime Guardrail holds the call and sends a request to your approvers:

- **In the app**, on the agent's Guardrail tab
- **In Slack**
- **Through a webhook**, for your own approval or ticketing system

The same request appears in each channel. The first response decides the request. An approver can select **Approve redacted**, which replaces sensitive values with placeholders and then allows the call. If no one responds within the time limit that you set, the request is denied.

## Use detections as tests

You can promote detections from production traces into test cases. The next experiment then includes them.
