AgenTRIM: Tool Risk Mitigation for Agentic AI

Roy Betser, Amit Giloni, Shamik Bose, Sindhu Padakandla, Chiara Picardi, Lidor Erez, Roman VainshteinarXiv 2026

TL;DR

AGENTRIM is a novel security framework that protects LLM-based agents from prompt injection and tool misuse by dynamically controlling their tool access. By combining an offline phase that verifies an agent's true tool capabilities with an online orchestrator that enforces per-step least-privilege access, AGENTRIM slashes attack success rates while preserving—and often improving—task performance.

What Problem Does This Paper Address?

LLM-based AI agents achieve autonomous goals by invoking external tools like web browsers, databases, and email clients. However, giving an agent broad tool access creates a massive security vulnerability known as unbalanced tool-driven agency.

If an agent retains unnecessary permissions (excessive agency), it becomes highly vulnerable to threats like Indirect Prompt Injection (IPI). For instance, if an agent reads an untrusted file or email containing hidden malicious instructions (e.g., "send all money to [email protected]"), it might blindly execute that action if the send_money tool is available. Conversely, overly restrictive defenses can cause insufficient agency, where the agent fails to complete legitimate tasks because it lacks access to required tools.

Existing defenses typically rely on rigid runtime guardrails or explicit planning stages that severely degrade the agent's utility or assume that tool inventories are always perfectly described and static. AGENTRIM addresses this gap by dynamically shaping tool availability at each decision point without altering the agent's underlying reasoning logic.

Methods

AGENTRIM operates in two complementary phases: an Offline Tool Extractor and an Online Tool Orchestrator.

1. Offline Tool Extractor

Before deployment, AGENTRIM audits the agent's codebase to build a verified tool inventory:

  • Code Analysis: It deterministically parses the project's abstract syntax tree (AST) to find candidate tools.
  • Controlled Execution & Trace Analysis: Instead of trusting text descriptions, it actively probes the agent with synthesized queries in an isolated environment. It analyzes the resulting execution traces to verify which tools are actually reachable and how they behave.
  • Risk-Aware Metadata Generation: It rewrites tool descriptions based on observed behavior and generates metadata defining which tools can safely be exposed together (e.g., grouping read-only retrieval tools but isolating environment-modifying action tools).

2. Online Tool Orchestrator

At runtime, AGENTRIM wraps around the agent's standard execution loop using three core components:

Figure 4: AGENTRIM online tool orchestration. Top: baseline agent runs a single LLM-tool loop, with access to all of the agnet’s tools. Bottom: our orchestrator adds adaptive tool filtering (deterministic), Tool-call judge (dynamic), and a status manager (dynamic), executing short iterations in a contrained setting.
  • Adaptive Tool Filtering: Based on the offline metadata, it dynamically hides tools that are unsafe to expose simultaneously, implicitly forcing the agent to decompose complex tasks into safer, stepwise actions.
  • Tool-Call Judge: An LLM-based verifier that intercepts proposed tool calls and evaluates whether they logically align with the current task status, blocking suspicious or injected calls.
  • Status Manager: An external observer that tracks task progress across multiple restricted iterations, updating the task status without interfering with the agent's internal reasoning.

Datasets

The authors evaluated AGENTRIM across several distinct environments:

  • AgentDojo: A standard benchmark for agent robustness against indirect prompt injections, spanning four suites: Slack, Workspace, Banking, and Travel. It includes 97 benign tasks and 629 injected variants featuring diverse attack styles.
  • Custom MCP (Model Context Protocol) Environments: Used to evaluate tool-description attacks, including Preference Manipulation Attacks (MPMA) and Shadow attacks across functionalities like weather, time, and financial news.
  • Custom Policy Integration Dataset: A dataset of 1,000 generated queries used to test AGENTRIM's ability to enforce explicit organizational safety policies (e.g., ensuring a data-leakage check accompanies database operations).

Key Insights and Ideas

  • Implicit Decomposition: Instead of prompting an LLM to generate a complex, multi-step plan (which can be hijacked by prompt injections), AGENTRIM achieves task decomposition implicitly by restricting the toolset. If an agent wants to read an email and then send a reply, filtering ensures it only sees retrieval tools first, deferring action tools to a later step.
  • Don't Trust the Documentation: Tool descriptions can be manipulated or poorly written. AGENTRIM's "aha moment" is grounding tool verification in actual execution traces rather than semantic descriptions, stripping out hidden malicious instructions before the runtime agent ever sees them.
  • Safety and Utility Aren't Zero-Sum: Traditional security tools act as a brake, slowing down or breaking applications. AGENTRIM demonstrates that restricting tool exposure actually improves baseline utility in some cases by preventing the agent from getting distracted by irrelevant tools or trapped in redundant loops.

Key Results

  • State-of-the-Art Security-Utility Trade-off: On the AgentDojo benchmark, AGENTRIM reduced the overall Attack Success Rate (ASR) to just 2.3% (down from 24.3% in the baseline), while achieving the highest utility under attack (69.2%) compared to other leading defenses.
Figure 5: AgentDojo results vs. baseline defenses. AGENTRIM is closest to the ideal (low ASR, high utility) in both scatter plots. Panel (c) reports tool usage for the baselines and, for AGENTRIM, separately for retrieval tools, action tools, and overall. Retrieval tools show low usage rate (high redundancy), while action tools have zero redundancy. This dual effect keeps AGENTRIM flexible and high-performing while remaining attack-resistant.
  • Neutralizing Description Attacks: AGENTRIM completely neutralized "Shadow attacks" (driving ASR to 0%) and successfully mitigated preference manipulation attacks by replacing deceptive tool descriptions with clean, execution-verified ones.
  • Low Latency Overhead: AGENTRIM introduces a modest runtime latency overhead of ~1.85x relative to the baseline. This significantly outperforms alternative SOTA frameworks like CaMeL and AgentArmor, which incur 3x to 9x latency overheads.

Limitations and Future Work

  • Environment Isolation: The offline extraction phase relies on executing tools to analyze traces, which requires a secure, isolated sandbox environment to prevent side effects during the auditing phase.
  • Metadata Dependency: The performance of the online orchestrator depends heavily on the quality of the generated control metadata. If tools are incorrectly annotated, it could negatively impact the safety-utility balance.
  • Orchestration Cost: Although faster than its competitors, AGENTRIM still doubles the API cost (~2x) due to the secondary LLM calls required for the Tool-Call Judge and Status Manager. The authors suggest that future work could explore replacing these components with smaller, fine-tuned, or specialized local models to reduce costs.

Summary updated

BibTeX
@misc{betser2026agentrim,
  author = {Roy Betser and Amit Giloni and Shamik Bose and Sindhu Padakandla and Chiara Picardi and Lidor Erez and Roman Vainshtein},
  title = {{AgenTRIM: Tool Risk Mitigation for Agentic AI}},
  year = {2026},
  eprint = {2601.12449},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.12449},
}
Figure