agent.yaml policy document.
Document Structure
An AIP policy document has four top-level sections:Top-Level Fields
The API version of the policy schema. Must be
aip.io/v1alpha2.Implementations will reject policies with unknown API versions.The type of policy document. Must be
AgentPolicy.Metadata Fields
Themetadata section identifies the policy and provides integrity verification.
Unique identifier for this policy. Used as the default
audience for identity tokens.Semantic version of the policy (e.g.,
"1.0.0", "2.1.3").Contact email for policy questions.
v1alpha2 feature. Cryptographic signature for policy integrity.Format:
<algorithm>:<base64-signature>Supported algorithms:ed25519- Ed25519 signature (RECOMMENDED)
Spec Fields
Thespec section contains the policy rules and enforcement configuration.
Enforcement Mode
Controls whether policy violations are blocked or just logged.
Use case: Set to
| Value | Behavior |
|---|---|
enforce | Block violations (default) |
monitor | Log violations but allow through |
monitor to dry-run new policies before enforcement.Tool Authorization
Allowlist of tool names the agent may invoke. Tool names must exactly match the MCP server’s tool list.Default behavior: If a tool is not in this list AND not in
tool_rules with action: allow, it will be blocked.Method Authorization
Allowlist of JSON-RPC methods permitted. If not specified, implementations use a default safe list.Default safe list (when not specified):
initialize,initialized,pingtools/call,tools/listcompletion/completenotifications/*cancelled
* allows all methods.Explicit denylist of JSON-RPC methods. Denied methods take precedence over allowed methods.
Path Protection
File paths that tools must not access. Any tool argument containing a protected path will be blocked.Automatic protections:
- The policy file itself is automatically protected
~is expanded to the user’s home directory
When
true, tool rules reject arguments not explicitly declared in allow_args.Tool Rules
Thespec.tool_rules array provides fine-grained control over individual tools.
Array of tool-specific rules.
ToolRule Fields
Tool name this rule applies to. Must match exactly.
Action to take when this tool is called.
| Value | Behavior |
|---|---|
allow | Permit (subject to argument validation) |
block | Deny unconditionally |
ask | Require interactive user approval |
Rate limit for this tool. Format:
<count>/<period>Supported periods: second, minute, hour (or s, m, h)When exceeded, requests return error code -32002.Override
strict_args_default for this specific tool.v1alpha2 feature. Cryptographic hash of the tool’s schema to prevent tool poisoning.Format:
<algorithm>:<hex-digest>Supported algorithms: sha256, sha384, sha512If the tool’s schema changes, requests return error code -32013.Argument validation patterns. Maps argument names to regex patterns.Validation rules:
- Regex must match the entire argument value
- Uses RE2-compatible regex syntax
- If any pattern fails, the request is blocked
- Missing constrained arguments are treated as violations
DLP Configuration
Data Loss Prevention scanning detects and redacts sensitive data in tool responses (and optionally requests).DLP configuration block.
Enable DLP scanning. Defaults to
true when the dlp block is present.v1alpha2 feature. Scan tool arguments before forwarding.Use case: Prevent data exfiltration via arguments (e.g., secrets embedded in API queries).
Scan tool responses for sensitive data.
v1alpha2 feature. Maximum content size to scan per request/response.Content exceeding this limit is truncated for scanning (first N bytes only).Format: Size string (e.g.,
"1MB", "512KB", "10MB")v1alpha2 feature. Action when DLP pattern matches in a request.
| Value | Behavior |
|---|---|
block | Reject with error -32001 |
redact | Replace matched content and forward |
warn | Log warning and forward unchanged |
Detect and scan base64-encoded content.
Scan stderr output from tools.
Array of regex patterns to detect.
DLP Pattern Fields
Rule identifier for audit logs and redaction markers.Matched content is replaced with
[REDACTED:<name>]RE2-compatible regex pattern.Built-in patterns:
v1alpha2 feature. Where to apply this pattern.
| Value | Description |
|---|---|
all | Scan both requests and responses |
request | Only scan requests |
response | Only scan responses |
Identity Configuration (v1alpha2)
Agent identity and session management features.Identity configuration block.
Enable identity token generation and management.
Token time-to-live. Format: Go duration string (e.g.,
"5m", "1h", "300s").Recommended: 5-15 minutes to limit token theft window.How often to rotate tokens before expiry.Constraint: Must be less than
token_ttl.When
true, all tool calls MUST include a valid identity token.Requests without tokens are rejected with error code -32008.Session binding mode.
| Value | Binding |
|---|---|
process | Bound to OS process ID |
policy | Bound to policy hash |
strict | Bound to process + policy + hostname |
Intended audience for identity tokens. Defaults to
metadata.name.Purpose: Prevents tokens issued for one MCP server from being accepted by another.Duration to retain nonces for replay detection. Defaults to
token_ttl.Grace period for tokens with old policy hash after policy update.
Server Configuration (v1alpha2)
HTTP server for remote validation endpoints.Server configuration block.
Enable HTTP server for remote validation.
Bind address and port. Format:
<host>:<port>Security: Binding to 0.0.0.0 requires TLS configuration.Behavior when validation server is unreachable.
| Value | Behavior | Security |
|---|---|---|
fail_closed | Deny all requests | High |
fail_open | Allow all requests | Low |
local_policy | Fall back to local policy | Medium |
Maximum time to wait for server response.
TLS configuration. Required when
listen is not localhost.Path to TLS certificate file (PEM format).
Path to TLS private key file (PEM format).
Complete Example
Validation
Common policy validation errors:| Error | Cause | Fix |
|---|---|---|
invalid apiVersion | Wrong API version | Use aip.io/v1alpha2 |
empty allowed_tools | No tools specified | Add tools or tool_rules |
invalid regex | Bad regex pattern | Validate regex syntax |
invalid rate_limit | Wrong format | Use <N>/<period> |
rotation_interval >= token_ttl | Rotation must happen before expiry | Reduce rotation_interval |
Next Steps
Error Codes
JSON-RPC error codes reference
Audit Format
Audit log format specification
Token Format
AAT token structure and claims
Examples
Example policies for common use cases