Implementation Guide

    Stopping an LLM Agent from Retrying a Denied Tool Call with Rewritten Arguments

    To prevent an LLM agent from retrying a denied tool call, enforce the decision in the execution path, outside the model's context, and treat it as final rather than advisory. Evaluate calls by operation, target and intent instead of exact argument strings, fail closed on unknown tools, track denials per session, cap retries, escalate exceptions to a human approval bound to the exact call, and record every attempt and outcome where the agent cannot write.

    Evaluation criteria for runtime enforcement

    • Is enforcement in the execution path, outside the model's context, and does it fail closed for unknown tools and missing approvals?
    • Do rules evaluate operation, target and intent, or only exact argument strings?
    • Are repeated or rewritten attempts counted, limited and escalated per session, user and tenant?
    • Are approvals bound to the actor and exact tool call, and are they single-use?
    • Is every attempt and outcome recorded outside the agent's write access, without secrets?
    • Is there a log-only mode before enforcement, and is the scope of per-call enforcement stated clearly?

    Why agents retry after a denial

    An agent loop feeds the output of earlier invocations into later model calls. A denial returned to the model therefore becomes part of its next input. If the denial reads like an ordinary error, the model has no reason to treat it differently from a malformed request, and it will often try to complete the task another way.

    This is why prompt-level instructions are weak controls. An instruction such as "do not retry denied actions" sits in the same context the model is reasoning over, so the model can reinterpret or deprioritize it. OWASP's agent security guidance puts tool authorization in the execution component, outside the agent's context, and says unauthorized tools are denied even when the model requests them confidently. The denial has to be something the model cannot negotiate with.

    Per-call argument checks have a related weakness. They answer whether this string is acceptable, not whether this agent should be doing this thing at all. A check that returns the same answer for every rewording of the same intent is what a durable denial needs.

    Common bypass patterns to design against

    The patterns below are what a security team should expect when a model treats a denial as an obstacle. They follow from how agents choose tools and parameters at run time, and they are useful as test cases for any enforcement design.

    • Argument rewriting: The same operation is resubmitted with a different path, identifier, filter or phrasing so an exact-match rule no longer fires.
    • Call splitting: One denied action is broken into several smaller calls, each of which looks acceptable alone.
    • Equivalent tool substitution: A different tool that achieves the same effect is used. Fail-closed handling of tools not yet in policy narrows this path.
    • Re-encoding the intent: The same request is expressed through another format, encoding or indirect reference.
    • Approval reuse: A prior approval is presented for a different call, or used again after it was consumed.

    Weak mitigations compared with enforcement in the execution path

    Each weaker control has a legitimate role, but none holds a denial across retries by itself.

    • System prompt instructions: Cheap to add, but they are advisory text inside the model's context. They do not stop a call from being proposed or executed.
    • Exact-match argument blocklists: Block known strings. Rewording, splitting or switching tools produces a call the list never anticipated.
    • Schema validation: Strict schemas constrain argument shape and are worth having. They do not express intent or resource-level policy.
    • Post-hoc log review: Shows what happened after the call ran. It does not prevent the retry that succeeds.
    • Enforcement in the execution path: Decides before execution, outside the model, using operation, target, intent and session state, and can allow, redact, block, rate limit or escalate.

    Implementation: holding a denial across retries

    Start with the placement decision. The policy decision point belongs in the component that executes tool calls, not in the agent. Fail closed for unknown tools and for calls whose approval requirements are missing. Begin in log-only mode to see how the agent behaves, then move to enforcement.

    Denial semantics are the least settled design choice. OWASP advises returning the reason a call was blocked so the agent can take a safe path, while the retry problem argues for a response the model cannot probe. One workable compromise is a stable denial code and a general category, an explicit statement that the decision is final for the session, and the sanctioned route (an approval request). Leave out matched patterns, thresholds and rule internals that would help the model craft a variant. Treat this as a design judgment to test against your own agents, not a settled result.

    • Evaluate operation, target and intent: Judge each call by what it does, to which resource, and whether it fits the original user intent, with parameter validation enforced separately.
    • Make the denial terminal: Return a final, non-negotiable response and record the denial against the session so later attempts are judged with that history.
    • Track state across attempts: Count denials per session and flag repetitive patterns. How you correlate rewritten attempts is an implementation decision to validate in testing.
    • Cap retries and calls: Set hard limits on tool calls per session, terminate on breach, and use circuit breakers that pause execution for human review on abnormal or repetitive activity.
    • Escalate with bound approvals: For high-impact or deviating actions, require human approval tied to the actor and exact call, valid only once, with full parameters displayed.
    • Capture evidence of every attempt: Write each decision to a store the agent cannot modify, and exclude secrets and sensitive argument content.

    Evidence and scope limits

    A regulated enterprise needs to show what the AI was allowed to do and what it did. For denied and repeated attempts, that means a record per attempt: the actor and session, the tool and target, the parameters with sensitive values excluded, the decision and the rule that produced it, any escalation and approval, and the outcome. Because the agent cannot write to the store, the record cannot be shaped by the behavior it describes.

    Trussed is one example of this approach. It enforces policy in the execution path across models, agents, tools and MCP servers, with allow, redact, block, rate limit and escalate for human approval, and it generates audit-ready evidence from that enforcement. Its scope is individual interactions and tool calls, and it can be self-managed in the customer cloud with configurable retention and data residency.

    The scope matters for any product you evaluate. Enforcement at the level of individual interactions and tool calls does not by itself reconstruct a business transaction across tasks and agents. If you need that view, treat it as a separate requirement and ask how it would be met.

    A denial held across retries

    Attempt

    The agent proposes a tool call that is evaluated before execution.

    Decision

    Policy returns allow, redact, block, rate limit or escalate.

    Retry

    Rewritten or split attempts are judged against session state and intent.

    Evidence

    Each attempt and outcome is recorded outside the agent's write access.

    Test your denial handling against real agent behavior

    See how policy is enforced in the execution path and how each attempt and outcome becomes audit-ready evidence.

    Explore Agent and Tool-Call Enforcement
    Next step

    How does your AI governance program compare?

    See where your program has gaps in less than 2 minutes.