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

# AgentGuard

> Session-level behavior monitoring that detects manipulation across an agent's full trajectory

AgentGuard is Runlayer's purpose-built ML model for agent reasoning security. Where per-call tool scanners look at one input or output at a time, AgentGuard watches the agent's trajectory across a session and detects when behavior diverges from the user's intent.

AgentGuard surfaces inside [Sessions](https://docs.runlayer.com/platform-sessions.md) on each agent turn.

## What AgentGuard detects

AgentGuard is built to catch agentic attacks that per-call scanners miss:

* **Output-steering injection** — a tool output contains hidden instructions that redirect the agent
* **Sudden reasoning pivots** — the agent's reasoning abruptly changes direction with no basis in the conversation
* **Slow-chain drift** — gradual, step-by-step divergence from the original task

It distinguishes legitimate behavior changes from genuine misalignment. A high-privilege operation that matches user intent is allowed; an agent autonomously taking the same action outside the requested task is not.

## Reading the turn scores

Each scored turn in [Sessions](https://docs.runlayer.com/platform-sessions.md) has three bars. A full bar is good. A bar turns red when it drops below 70%.

| Bar | What it measures |
| - | - |
| **Alignment** | How close the agent's reasoning after a tool call stays to what the user asked for |
| **Stability** | The larger of two shifts: how far the agent's reasoning moved across the tool call, and how much the tool output changed from the previous turn. The first turn of a session has no previous output, so only the reasoning shift counts |
| **Safety** | The score from AgentGuard's classifier for the turn. Missing when the classifier didn't answer for that turn |

A turn is flagged when the combined drift (alignment plus both stability shifts) or the classifier crosses its threshold. The **Strict**, **Balanced** and **Moderate** sensitivity levels move those thresholds; at **Moderate** both must agree before a turn is flagged, unless the classifier is unavailable, in which case the drift check decides alone.

## Safety over Time chart

A session with more than one scored turn shows a **Safety over Time** chart above its key moments.

* **Height**: each point is one turn's **Safety** score, the classifier's score shown as a percentage. 100% means the classifier found no risk. A turn the classifier didn't score is drawn at 100%.
* **Flagged turns**: a dip alone doesn't mean a turn was flagged. A turn is flagged only when the classifier or the drift check crosses the threshold for your sensitivity level (see [Reading the turn scores](#reading-the-turn-scores)). The drift check isn't drawn on the line, so a turn can be flagged on drift without a dip.
* **Color**: the whole line takes the worst verdict in the session. Green means no turn was flagged. Amber means a turn was flagged while agent monitoring is set to **Alert** (or the session is monitor-only); red means a turn was flagged while it is set to **Block**.
* **Hover**: a point shows that turn's time, whether it was flagged, which check crossed its threshold, and its Alignment, Stability and Safety bars.

## Configuration

AgentGuard is configured under **Settings → Security Scanners → Session scanning**.

### Agent monitoring

The main toggle for AgentGuard.

| Action | Behavior |
| - | - |
| Allow | Disable agent monitoring |
| Alert | Record detected threats; tool calls continue |
| Block | Block all subsequent tool calls in the session when a threat is detected |

> [!NOTE]
>
> Sessions in AI Watch **Monitor** mode, and other monitor-only sessions, are still scored. A detection is recorded as an **Alert** even when Agent monitoring is set to **Block**, and tool calls are never blocked.

### Block later tool calls when any scanner blocks

When any per-call scanner blocks a tool call, every later tool call in the session is denied too. The agent keeps running but can't use tools. To end a session yourself, use **Stop** on the session.

| Action | Behavior |
| - | - |
| Allow | A blocked tool call blocks only that call |
| Block | A blocked tool call denies every later tool call in the session |

With this setting off, nothing enforces a session-level block, so Sessions shows that session as **Flagged** instead of **Blocked**.

> [!NOTE]
>
> AgentGuard is configured globally. Per-connector and per-client overrides apply to catalog and per-call tool scanners, not to AgentGuard.

## Rollout guidance

1. Start in **Alert** so you can see what AgentGuard would do without affecting agents in production.
2. Review Flagged sessions in [Sessions](https://docs.runlayer.com/platform-sessions.md) and confirm the verdicts match your security policy.
3. Move **Agent monitoring** to **Block** for high-risk teams or agents first.
4. Enable **Block later tool calls when any scanner blocks** once your per-call scanner tuning is stable.

## Requirements

* Sessions enabled for the workspace (Settings → Agent session monitoring)
* A deployment with ToolGuard capabilities

If AgentGuard options do not appear in Security Scanners, confirm both above.

## Related docs

> [card] [ToolGuard Models](https://docs.runlayer.com/runlayer-toolguard.md)
>
> Per-call tool scanners and configuration

> [card] [Sessions](https://docs.runlayer.com/platform-sessions.md)
>
> Where AgentGuard verdicts appear in the agent timeline

> [card] [Policies](https://docs.runlayer.com/platform-policies.md)
>
> Restrict tools using access policies


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.