Specialist playbooks4 min read

Limit What an Agent Can Reach and Do

How to constrain data, tools and actions when an agent encounters untrusted content.

An agent operates inside narrow data, tool, approval, and execution boundaries while untrusted content remains isolated.
On this page
  1. 1.Map the path to harm
  2. 2.Restrict authority per task
  3. 3.Contain execution
  4. 4.Bound retries, time and cost
  5. 5.Test and contain

An agent reads a document to answer a user's question. The document contains an instruction to send private records elsewhere. If the agent can read those records and send messages, the untrusted content has a route to a consequential action.

The product team cannot assume the model will always distinguish the attack from legitimate work. Design the system so that a manipulated model has limited access and cannot authorise its own actions.

Map the path to harm

For the specific job, identify what untrusted content can enter, which sensitive information the system can read, which tools and credentials it can use, and what external effects it can cause. Ask how an unwanted action would be detected, stopped and recovered.

Direct attacks may arrive in a user's request. Indirect attacks may be embedded in a webpage, email, document, image, retrieved record or tool result. Test each relevant path. A source can be useful evidence without having authority to change the user's task.

Restrict authority per task

A task passes through narrow data, tool, approval, and execution boundaries before an agent can act.

Give the system only the data and actions required for the current work. Separate read and write permissions where possible. Restrict tenants, records, fields, destinations, amounts and time windows. Validate tool arguments against the authenticated user, the task and current policy. Require appropriate authorisation before scope expands.

Where the workflow allows it, separate reading untrusted content from executing consequential actions. Convert proposed actions into validated structures and check them against the original request and permissions. A free-text summary of untrusted material can itself carry an instruction; changing its container does not automatically make it safe.

Human approval helps when the reviewer has the evidence, time and authority to make a meaningful decision. Test whether reviewers can recognise seeded failures and understand the action they are approving.

Contain execution

Generated code or commands need a constrained environment. Limit filesystem and network access, secrets, processes, runtime, memory, spend and persistence. Validate output before it reaches a privileged system. Design for failure rather than relying on the model to follow an instruction.

Treat context, memory and tools as maintained dependencies. Preserve the source and trust level of important material, review tool changes and revoke credentials when a workflow is retired. The harness chapter covers tool contracts and context; agent ownership covers ongoing responsibility.

Bound retries, time and cost

An agent can receive a timeout after a tool has already completed an action. Retrying without checking may create a duplicate. For each consequential tool, define what happens on timeout, partial success and repeated calls. Use an idempotency mechanism or another appropriate safeguard, and record enough state to determine what happened before retrying.

Set and test limits on tool calls, elapsed time, spending and action scope. Include legitimate variation and recovery in the budget. Exercise unavailable tools and partial completion, and check that exceeding a limit stops or escalates safely. A circuit breaker is useful only if the team knows how to recover after it trips.

Inspect traces as well as final results. A plausible answer may conceal unnecessary retrieval, a repeated call or an action that should never have been attempted. Use deterministic checks, human review and, where appropriate, a calibrated model-based grader. Protect trace data, and sample apparently successful runs for failures that did not generate a complaint.

Repeat relevant tests when models, context, tool schemas, users or operating conditions change. Maintain a tested fallback or narrower mode where needed. Incidents may call for a new evaluation case, but the appropriate fix could instead be a permission, tool contract, source of context or recovery procedure.

Test and contain

Build tests around the actual workflow: attempts to override the task, instructions embedded in each untrusted source, cross-user data access, manipulated tool arguments, exfiltration, memory poisoning and combinations of permitted actions that create a prohibited result. Include timeouts, partial completion, duplicate actions, approval and shutdown paths.

Static cases are useful for regression; adaptive testing can reveal new paths. Record enough protected information to reconstruct the initiating request, relevant context, proposed and executed actions, permissions, approvals and outcome. Traces can contain sensitive data and need their own access and retention controls.

Before release, establish who can pause work, revoke access, stop in-flight execution, isolate affected systems, preserve evidence and coordinate recovery. Test those capabilities.

Security guidance and secure development guidance provide further technical detail. Apply them with security specialists to the system and environment being built.

v3.1 · Updated Oct 2026