AI Agents
Guardrails for enterprise AI agents
Design layered safeguards for agent identity, untrusted retrieved data, tool permissions, consequential actions, monitoring, and recovery.
Layer controls around the trust boundaries
Agent safety is a system property. Combine identity, data minimization, constrained tool schemas, network egress controls where applicable, input and output checks, human review, and monitoring. A content filter can reduce some classes of risk, but it does not replace authorization or application validation.
Treat user prompts, retrieved pages, uploaded files, tool output, and model responses as potentially hostile or malformed. Keep secrets out of prompts and avoid giving one agent broad credentials simply because it is convenient.
- Use read-only tools by default and separate identities for different trust zones
- Allowlist operations and destinations; validate identifiers, ranges, and ownership
- Require fresh authorization at execution time for sensitive actions
- Bound request size, loops, retries, runtime, and tool-call count
Design approval for consequential actions
Human approval should be a real authorization step, not a model-generated sentence claiming that a person approved. Present the exact proposed action, target, material arguments, and consequences to an authenticated reviewer; bind the approval to that payload and expire it if the payload changes.
For high-impact operations, use a two-phase pattern: the agent proposes a typed action, deterministic policy validates it, and a separate service executes only after the required approval. Make retries idempotent where possible so network timeouts do not duplicate a purchase, message, or deployment.
Threat-model the ways controls can fail
Test direct and indirect prompt injection, data exfiltration, cross-user access, tool misuse, malformed tool arguments, stale permissions, unavailable services, and a compromised or misleading downstream result. Include attacks embedded in retrieved content; a trusted search service can return untrusted documents.
For each test, define the expected behavior: refuse, ask for clarification, return a safe summary, request approval, or stop and alert an operator. Record the result and block releases on critical authorization or data-leak regressions.
Operate and recover
Log enough to reconstruct decisions without copying credentials or unnecessary personal data into telemetry. Capture correlation IDs, policy decisions, tool name, outcome, latency, and a redacted error category. Restrict access and retention for traces that may contain sensitive context.
Define an owner, an incident path, a way to disable a tool or agent, and a rollback process. Re-test the guardrails after changing prompts, models, tools, retrieval sources, permissions, or platform configuration; each can alter the effective behavior.
Frequently asked questions
Can a guardrail prompt prevent an agent from taking an unsafe action?+
It can guide behavior but is not an authorization boundary. Enforce permissions and input validation in the tool or service that executes the action, and test adversarial and failure cases.
When should a human approve an agent action?+
Use approval when impact, reversibility, uncertainty, or policy requires it. Show the exact action and bind approval to the validated payload so it cannot be silently changed afterward.
Do content filters stop prompt injection?+
Filters and platform controls can help detect or mitigate some attacks, but they are not a complete defense. Use least privilege, constrained tools, data boundaries, evaluations, and operational monitoring as well.
Official sources
Use these primary references to verify product capabilities, exam objectives, and implementation details.
Put this into practice
Review concrete prompt and tool safeguards, then test them with the agent evaluation guide before release.
Open resource