Skip to main content
Agent Guard is Sec0’s in-device content scanning engine. It runs inline on every tool invocation to detect prompt injection, PII leakage, secrets exposure, toxic content, and malicious code on both inputs and outputs. Agent Guard is configured as part of the middleware and runs in-process for zero-latency enforcement.

Enabling Agent Guard

Via Middleware Options

Via Policy YAML

Built-in Detectors

Agent Guard includes the following detectors out of the box:

Finding Structure

Each finding follows a structured format:

Severity Levels

Scan Locations

Custom Patterns

Override the built-in regex patterns for any detector:

External Scanner Adapters

Chain external scanning services for additional coverage:

Custom Adapter

Run Context Scanning

Enable accumulated run-context scanning to detect multi-turn attacks:

Enforcement

Agent Guard integrates with Sec0’s policy enforcement:
  • Observe mode (deny_on: []): Findings are logged in audit envelopes but requests are not blocked
  • Enforce mode (deny_on: ["agent_guard_failed"]): Requests are blocked when findings exceed the configured threshold
The agent_guard_findings array is always included in the audit envelope, regardless of enforcement mode. For the full Agent Guard options reference, see Middleware Options Reference.