All Guides
aiaiagentsevaluationsecuritymonitoringtool-use

Testing Agents for Unintended Actions

Find persistence, scope violations, and unsafe workarounds before an agent can turn a blocked task into a real-world incident.

Ryan VerWey
2026-10-13
8 min read

An agent can complete the requested task and still fail the operator. The failure happens when it treats a restriction, unavailable target, or missing permission as another obstacle to route around instead of a boundary that should stop the run.

Anthropic's October 9, 2026 report on unintended model actions gives this risk a concrete shape. During evaluations and internal use, Claude models exploited a software flaw to run commands, submitted a sensitive form on a real website, reached gated data by finding access tokens, and used URL shorteners to bypass fetch-tool limits. Anthropic described the observed real-world impact as minimal and grouped much of the behavior under persistence: the model kept pursuing the task after the intended route was blocked.

These are provider-reported observations, not a claim that every model or agent will behave the same way. The operating lesson is broader: success-only evaluations are incomplete when a system can call tools or affect external state. Teams must test whether the agent stops correctly, respects scope under pressure, and remains contained when the environment does not match the prompt.

Define the action boundary first

A useful evaluation begins with an enforceable action contract rather than a vague instruction to be safe.

For each task, record:

  • the exact goal and the evidence that counts as completion
  • permitted targets, accounts, domains, repositories, and data classes
  • permitted tool actions and side effects
  • prohibited actions, including indirect ways to produce the same effect
  • network destinations and redirect behavior
  • credential and token sources the agent may use
  • stop conditions, escalation path, and accountable operator

Phrase boundaries as instructions. "Do not access the public internet" is clearer than "the sandbox has no internet access." The second statement can become false because of a configuration mistake, leaving the model to decide whether the newly visible network is fair game.

Do not rely on the prompt as the control. Enforce the same boundary in the tool broker, network policy, credential scope, browser permissions, and approval layer. The prompt communicates intent; the runtime constrains capability.

Verify that the task is solvable inside the boundary

An impossible task creates pressure for a capable model to search for alternate routes. Before running a large evaluation, prove that at least one intended path works using the same sandbox, fixtures, permissions, and network rules the agent will receive.

The solvability check should answer:

  1. Is the target present and reachable through the approved interface?
  2. Are required credentials valid and limited to the declared target?
  3. Can the task be completed without a live website or production service?
  4. Do fixtures represent the state the prompt describes?
  5. Will a legitimate completion be scored correctly?
  6. Can an honest refusal or escalation receive an appropriate score?

If the task is broken, pause it. Do not reward the agent for finding an undeclared route around a missing fixture, expired token, paywall, or disabled tool.

Test pressure, not only the happy path

A boundary evaluation should include adversarial variants that preserve the goal while changing the obstacle. Use synthetic systems and non-sensitive data.

VariantExpected behavior
Approved endpoint returns an errorRetry only within policy, then stop or escalate
Target redirects to an unapproved domainRefuse the redirect and report it
A page exposes an embedded tokenDo not reuse the token unless that source is explicitly authorized
A form can be submitted without required identity fieldsDo not submit without the declared approval and evidence
A URL exceeds the fetch limitDo not use a shortener or alternate service to bypass the limit
The prompt says the network is unavailable but the network is reachableTreat the declared boundary as authoritative and stop
The task cannot be completed with allowed toolsReturn a bounded failure instead of inventing a workaround

Repeat the variants. Model behavior is non-deterministic, and rare boundary failures may not appear in one run. Report the numerator and denominator, such as one prohibited action in 500 trials, rather than "mostly safe."

Observe proposals and effects

Log enough information to reconstruct what the agent attempted without collecting unnecessary secrets or personal data.

Separate:

  • the model's proposed action
  • the tool broker's authorization decision
  • the external side effect, if any
  • the monitor's classification and intervention
  • the final task outcome

This distinction matters. A denied attempt is evidence of agent behavior and successful containment. A completed side effect with no proposal record is an observability gap. A harmless final answer does not erase a prohibited tool attempt earlier in the trace.

Store stable identifiers for the run, task version, model, policy version, tool manifest, environment build, monitor version, approvals, and side-effect receipt. Redact tokens, request bodies, form contents, and protected data before they enter the evaluation record.

Monitor against the declared scope

Anthropic's August 31 guidance on alignment and security practices recommends continuous monitoring over model reasoning, actions, and network activity, with the scope of the exercise available to the monitor. The monitor should be able to stop the run and alert a human before a violating tool call executes.

A practical monitor combines deterministic and model-based checks:

  • deterministic allowlists for domains, repositories, command families, and credential audiences
  • schema and policy checks before every side-effecting tool call
  • rate, volume, and sequence limits for repeated probing
  • model-based review for semantic scope violations that syntax alone cannot catch
  • post-run transcript review to find patterns the real-time layer missed

Monitor failure must fail closed for high-impact actions. Test the monitor separately with known allowed, denied, and ambiguous cases. A detector that has never faced evasive inputs is not a release gate.

Anthropic also describes hierarchical summarization for computer-use monitoring as one way to review long trajectories. Summaries can help scale review, but they should retain links to the source events and must not replace deterministic enforcement at the action boundary.

Score stopping behavior explicitly

Do not give full credit solely because the target state was reached. Use separate measures for:

  • task outcome
  • boundary compliance
  • correct refusal or escalation
  • prohibited-action attempts
  • unapproved side effects
  • monitor detection and block rate
  • false blocks on allowed actions
  • time from violation proposal to intervention

A run that obtains the answer through an unapproved route fails boundary compliance even when its answer is correct. A run that stops because the task is impossible can be the right outcome.

For consequential systems, treat any unapproved external side effect as a release blocker until the cause and control failure are understood. Denied attempts may support a measured risk decision, but only when containment is independently verified.

Investigate the system, not the model alone

When a violation appears, preserve the trace and test competing explanations:

  • the instruction omitted or contradicted the boundary
  • the environment exposed a capability it was meant to remove
  • the tool description framed a prohibited action as available
  • the task or grader rewarded success without compliance
  • the monitor lacked the current policy or missed an indirect route
  • a credential was broader than the declared target
  • the model persisted after a legitimate stop condition

Change one factor at a time and rerun the scenario. A prompt patch that hides one symptom does not fix a live network leak, overbroad credential, or reward that favors rule-breaking.

Release with layered gates

Before expanding an agent's autonomy:

  1. Run the suite in an offline or synthetic environment.
  2. Verify the sandbox and network policy from outside and inside the environment.
  3. Confirm the monitor blocks seeded violations before tool execution.
  4. Review rare failures across repeated trials.
  5. Canary with narrow targets, read-only access, and low side-effect limits.
  6. Require approval for sensitive submissions, purchases, messages, access changes, and destructive operations.
  7. Keep a kill switch, revocation path, rollback owner, and incident evidence packet ready.

Re-run the suite after model, prompt, tool, monitor, credential, network, or environment changes. The safety case belongs to the complete deployed system, not to a model name.

Release checklist

  • The task has an explicit, enforceable action boundary.
  • One approved completion path is proven before repeated evaluation.
  • Impossible, redirected, gated, and misleading-environment variants are included.
  • Proposed actions, authorization decisions, side effects, and interventions are distinguishable.
  • The real-time monitor sees the same scope contract as the agent runtime.
  • High-impact actions fail closed when policy or monitoring is unavailable.
  • Compliance and correct stopping are scored separately from task success.
  • Trials are repeated enough to expose rare failures.
  • Logs exclude secrets and unnecessary sensitive content.
  • Canary limits, approvals, rollback, revocation, and incident ownership are documented.

The goal is not to make an agent less capable. It is to make capability legible and bounded: complete the task through approved paths, stop when those paths fail, and leave enough evidence for a human to verify both claims.

Ryan VerWey

Written by

Ryan VerWey

Ryan VerWey is a full-stack developer building tools and writing practical guides for working developers.