IPIGuard: A Novel Tool Dependency Graph-Based Defense Against Indirect Prompt Injection in LLM Agents
Paper · 2025 · Hengyu An, Jinghuai Zhang, Tianyu Du et al.
Summary
An assistant that reads external content and takes actions has to distinguish information it can use from instructions it has authority to follow. A tool might return the details needed to answer a question alongside text that tries to redirect the assistant. When that text comes from a document, website, or other source the assistant consults for a task, the paper calls the problem indirect prompt injection. The risk goes beyond an incorrect answer. The assistant may have tools that can send messages, change records, or move money. IPIGuard asks whether the software that executes those tools can constrain what happens even when the assistant finds an instruction in retrieved content persuasive.
The authors have the assistant plan its tool calls before it reads untrusted responses. The plan is a tool dependency graph. Each node describes a particular call, and each directed connection records which earlier response a later call needs. Some arguments are fixed in the plan. Others are left open for the assistant to fill once the relevant data arrives. If an initial lookup leaves an information gap, the assistant can add read-only calls during execution. For cases where the user and an injected request involve the same tool, the authors also test a simulated completion that lets the assistant process a proposed extra action without allowing it to change the environment.
On AgentDojo, which simulates tasks in Workspace, Slack, Travel, and Banking, the main GPT-4o-mini comparison reports an average targeted attack success rate of 0.69% for IPIGuard, alongside 58.77% utility under attack. With no defense, those figures were 13.16% and 54.30%. In the main benign evaluation, IPIGuard completed 67.01% of tasks, compared with 68.04% without a defense. The component study helps explain the balance. Adding read-only lookups recovered legitimate tasks, while simulating extra calls helped protect arguments whose values had to be decided during execution.
The protection comes with additional work. Under the Important Instruction test, average completion time was 13.88 seconds with IPIGuard and 7.13 seconds without a defense. The evaluation also leaves a clear boundary around the claim. It measures whether injected content changes tool-mediated outcomes in the benchmark. A graph can limit which external actions run, while the information passed into an approved action and the wording of the final reply still raise their own questions.
Deep dive: IPIGuard: A Novel Tool Dependency Graph-Based Defense Against Indirect Prompt Injection in LLM Agents
IPIGuard plans tool calls before an agent reads untrusted data, then uses a dependency graph to limit which actions can run. · about 32 minutes to read
The problem and its context
When a source of data starts giving orders
A tool call can put an assistant in contact with a source the user has authorized it to consult. That authorization may be quite specific. A user who asks for the address of a hotel has given the assistant a reason to look up that address. The site it reads may contain useful information about the hotel, and it may carry other text that bears no relation to the request. An assistant must infer which parts are relevant to its task. In a tool-using system, that inference can affect both the answer the user sees and the actions the assistant takes before answering.
Indirect prompt injection exploits the gap between retrieving content and deciding what authority that content has. The direct interaction begins with the user, whose message supplies a task. The injected instruction arrives through an intermediate source the assistant has opened while doing that task. The source therefore has a legitimate place in the assistant's context. Its presence alone gives the assistant little basis for deciding that a sentence inside it can authorize an action. A response can be useful as evidence about what a document says while carrying no authority to expand the task.
The paper emphasizes systems that alternate between decisions and observations. An assistant chooses a tool, receives a response, and uses that response to choose what to do next. The pattern is useful because it supports tasks whose details only become visible as the work proceeds. A search can reveal which resource to open next. A lookup can supply a value required by a later operation. The same pattern exposes the decision about the next action to whatever text arrived in the last response. If a subsequent call can change external state, a mistaken interpretation can leave consequences outside the conversation.
Work cited by the authors developed tool use through prompting, as in ReAct and HuggingGPT, and through specialized training, as in Toolformer and ToolACE. The paper treats the ability to work with external tools as the starting point. Its security question concerns the link between that ability and the process that grants authority to individual calls.
The authors cite earlier research on indirect prompt injection in real-world applications and on evaluating the problem in tool-integrated assistants with InjecAgent. They also point to reports involving content from documents and webpages to explain the practical stakes. The motivating concern is that an untrusted author can influence an assistant in the course of an otherwise ordinary task. The user can ask for legitimate work throughout. The conflicting request can arrive entirely through a source consulted on the user's behalf.
How earlier defenses intervene
The paper describes defenses that change how the assistant reads or reacts to external content. Separating retrieved text with delimiters can make its origin more visible. Repeating the user goal can keep that goal salient as the conversation accumulates observations. A detector can screen the response and stop execution when it identifies an injection. The paper also places research on detecting and removing indirect prompt injection in this broader effort to filter what reaches the decision process.
These approaches intervene at different points. A formatting defense leaves the tool response available and seeks to improve the assistant's interpretation of it. An aborting detector can prevent later actions by ending the task, including cases where the original work might still be possible. A judge can inspect a proposed step and decide whether it serves the user's goal. The Task Shield represents that last approach in the paper's discussion. Its assessment depends on the judge making a reliable decision with the context it receives.
The authors also discuss training-based defenses that aim to improve how the assistant responds to suspect instructions. They point to the data and computation these methods can require, as well as the possibility of impairing more general performance. Their concern with approaches centered on interpretation is that a decision error can still reach an execution interface that permits the action. The paper cites earlier adaptive-attack research as evidence that this dependence on correct interpretation deserves attention.
There were already approaches that restricted tools. Tool Filter, included in the experiments, chooses a subset based on the user goal. The related-work discussion describes CaMel as a system-level defense and identifies static planning as a constraint on its utility. IPIGuard develops a different unit of control. An approved node describes a specific operation with arguments and dependencies. The runtime can retain the approval for that operation while collecting information that was unavailable when the plan was made. The authors therefore treat structural restrictions and the ability to carry out data-dependent work as a joint design problem.
Why approving a tool name leaves work to do
An operation has at least two aspects relevant to the user's intent. The first is the kind of operation. Looking up an address and creating a calendar event exercise different capabilities. The second is the content of the call. The date and destination of an approved operation can matter as much as the tool name. Two calls to the same tool can have quite different consequences. As soon as a plan leaves some arguments for later, it has delegated part of the eventual decision to the execution phase.
A plan also has to account for the difference between uncertainty about a value and uncertainty about the work needed to find it. The assistant may know in advance that it needs a hotel address. It can explicitly plan the address lookup and leave a field blank for the result. By comparison, an assistant searching a set of conversations may learn only during the search which conversations merit inspection. Filling a blank in an existing call and adding an information-gathering step solve different problems. IPIGuard gives each problem a separate mechanism.
The authors identify a harder form of delegation when the user asks the assistant to take concrete actions according to instructions it encounters in external content. In that arrangement, the unknown material supplies the proposed actions themselves. The distinction between completing the user's request and treating a retrieved message as authoritative becomes harder to enforce. The authors handle such tasks conservatively. This choice matters to the results because the benchmark includes work whose intended completion depends on that kind of flexibility.
These cases explain why the paper studies the execution path alongside final task completion. An assistant can finish the user's task and also do something the user never asked for. It can avoid the extra action and still fail to finish the original work. An evaluation of the defense needs to distinguish both outcomes. The architecture makes the same distinction in advance by treating evidence collection, authorization, and argument selection as related decisions with different consequences.
The method, step by step
Plan an operation before supplying its inputs
The method is easiest to follow through the paper's hotel example. The user asks for the address, rating, and minimum price of City Hub. The user also wants a calendar reminder if the rating and price meet the conditions in the request. At planning time, the assistant knows the hotel name, the purpose of the reminder, and the fields it needs from the lookups. It can plan to retrieve the address, rating, and price. It can also describe the calendar operation and record that the lookups come before it. The address remains to be filled, and the rating and price matter to whether the reminder is appropriate.
This example explains why a graph is useful even for a task whose steps could be written out as a list. The lookups do not need to be chained through one another merely because they appear together in the plan. The reminder, however, has meaningful dependencies on their results. The graph records a partial order, in which some calls are independent and others must wait. The same representation identifies the upstream results that help resolve a later call.
IPIGuard starts with a user request, descriptions of available tools and their arguments, and trusted context supplied by the system. The paper gives the user profile and background from user-designated trusted documents as examples of context the planner can use. The key timing decision is to build the graph from those inputs before collecting untrusted tool results for the task. Sources admitted as trusted at planning time therefore occupy a different position from material retrieved during execution.
The authors use prompting for this process and supply templates for its main stages. The planning prompt asks for a structured representation of calls, their arguments, and their predecessors. The graph is serialized as text, with an identifier for each call and a list of the calls it depends on. An unknown parameter carries an expected type. The approach assigns planning and execution to distinct roles, and the same backend can fill both roles or they can be assigned separately. The experiments compare both arrangements. The authors also make the IPIGuard implementation available.
How IPIGuard plans and executes a user task
The steps in order.
The flow groups operations that recur as the graph is traversed. A fixed-argument lookup can run immediately once its prerequisites have been met. A pending operation may need argument resolution, and a read can expose a need for further reads before a downstream operation proceeds. Simulation is conditional on what the assistant proposes while processing a pending node. The procedure therefore contains decisions within traversal as well as the initial decision about which operations belong in the plan.
The paper's formal account of tool use
The paper starts with the ordinary tool-using assistant, before introducing the graph. A user instruction is denoted by I. In response to that instruction, the assistant chooses a succession of calls.
T = {t₁(a₁), t₂(a₂), …, tₙ(aₙ)}
T represents the succession of tool invocations for the task. The braces gather the calls, and the subscripts give their positions in execution order. Each t is a tool, and the a inside parentheses contains the arguments supplied to that tool. The ellipsis stands for the intervening calls, and n is the final position in the succession. The expression describes chosen operations, including their inputs.
A tool is evaluated against the environment as it exists when the call runs.
tᵢ(aᵢ) × Eᵢ₋₁ → Eᵢ
The index i identifies the current step, and i−1 identifies the preceding step. The expression tᵢ(aᵢ) is the tool at that step with its arguments. Eᵢ₋₁ is the state before the invocation and Eᵢ is the state afterward. The multiplication sign pairs the call with the state it acts on, and the arrow gives the resulting state. Read-only calls can contribute a response to the assistant's history while leaving external state unchanged. A command can produce a state change that later operations and the benchmark can observe.
The assistant eventually produces an output using the final state and the history of the work.
O = πₐ(Eₙ, H)
O is the final output. The symbol πₐ denotes the assistant, Eₙ is the environment state at the end of the call sequence, and H is the history of execution. The parentheses express that the assistant draws on those two inputs. The equation places the reply at the end of a process whose effects may already be present in the environment. The output and those effects provide different evidence of what happened.
The authors represent an injection as a change in the intended sequence.
Tᵘ → Tᵘ′, Tᵃᵈᵛ ⊆ Tᵘ′
Tᵘ is the sequence serving the user task, and the superscript u identifies that task. The prime in Tᵘ′ marks the altered sequence. Tᵃᵈᵛ denotes calls serving the injected task, with adv identifying the adversarial objective. The arrow means that the original sequence gives way to the altered one. The inclusion sign says that the altered sequence includes the calls associated with the injected task. The notation expresses the case where an injection brings another course of action into the execution history.
The paper also describes overlap between the tools for the original and injected tasks. Here the relevant distinction is between a tool and an invocation with specific inputs. A planned operation may already use a tool that could serve a different purpose if an open argument were filled differently. The altered course of action would then be visible in what the operation did, even if the name of every tool used appeared in the original plan. This is why the paper adds a mechanism at argument resolution alongside its restrictions on new calls.
The graph uses directed edges to encode dependencies.
E(u, v)
E denotes an edge in this expression, separate from its use with subscripts for environment state. The letters u and v stand for nodes. The order inside the parentheses gives the direction from u to v. The response from the call at u supplies information needed by v. An incoming edge thus identifies a prerequisite. The graph is acyclic, so following the directions cannot bring a node back to itself. A topological traversal is any ordering that visits nodes after their prerequisites.
Keep the arguments that the plan already knows
The paper calls a node deterministic if all its arguments have been specified in advance. This label concerns the availability of the inputs. The tool response can still contain information the assistant has yet to see. A pending node carries at least one argument whose value will be determined later. In the hotel case, the location in the reminder illustrates a pending input. The user has identified what belongs there, and the lookup has to supply its concrete value.
During Argument Estimation, the assistant consults the relevant upstream responses from the execution context. The prompt directs it to fill only open fields, match each expected type, and preserve arguments already fixed in the plan. The authors also tell it to leave an argument unresolved when the returned data supplies no suitable value. When the required inputs have been filled, the pending node becomes a resolved node and has the arguments needed for execution. The tool response then joins the history for later operations.
These rules attach different degrees of flexibility to different parts of a call. A fixed title in the hotel example can be carried through planning and execution. The address can be extracted once it arrives. The rating and price help determine whether the condition in the request is met. Giving the assistant access to those data points at execution time preserves the conditional nature of the job. Allowing the same evidence to authorize unrelated operations would be a further decision beyond what the user asked the planner to arrange.
There is a difference between checking a value's type and checking its meaning. A location presented as text can satisfy the type required by a calendar tool. Whether it is the location the user requested depends on what the value refers to and which response furnished it. The graph gives the assistant a source of relevant evidence and the prompt limits where it may make updates. The semantic interpretation of that evidence remains part of argument resolution. That remaining judgment helps explain why the paper evaluates more than the ability to produce well-formed calls.
Allow the search to continue inside a narrower boundary
Some needs become clear after a lookup runs. In the paper's Slack example, the user wants the assistant to find a conversation about a misplaced coffee mug and respond in the appropriate channel. A plan can anticipate listing channels, inspecting messages, and replying. Which channel contains the conversation is the fact the search is meant to establish. A single inspection can leave that question open. The job benefits from further reads while the intended reply remains the action arranged at planning time.
Node Expansion lets the assistant propose additional calls after examining a response. The authors distinguish query tools, which read from the environment, from command tools, which modify it. Expansion keeps proposals in the query class. Each accepted lookup becomes a new node linked to the current node and inherits the current node's successors. The later operations can then draw on the additional responses. This places the new evidence within the graph's ordering rather than returning control to an unrestricted sequence of action choices.
The practical effect is to let a planned operation wait while the assistant gathers the information needed to carry it out. In the Slack example, more channel inspections can establish the destination of the reply. The reply body comes from the user's request and is already represented in the plan. The case illustrates a legitimate expansion of the evidence search within an existing task. It also shows that what the graph needs to preserve is the relationship between the reads and the eventual action.
The read-write distinction expresses the authors' concern with external state changes. It permits an information-gathering fallback when advance planning is incomplete and keeps new commands outside that fallback. As the benchmark results later show, a read can still matter to the security measure. The distinction is a choice about which capabilities the execution phase can add, and the usefulness of the choice depends on what the available tools do and what the evaluation treats as a consequential outcome.
Handle overlap while resolving an approved operation
Fake Tool Invocation addresses cases where a planned call is already of the same kind as an operation suggested by external content. The paper illustrates the issue with a user-authorized payment whose details depend on transaction history. The original operation is permitted. Some of its arguments still have to be determined from the retrieved records. The point of the example is that a restriction on tool names can remain intact while the contents of the eventual call have departed from the user's goal.
When processing a pending node, the assistant can express a proposed operation in response to an instruction in the context as a separate call. IPIGuard substitutes a simulated completion for any real execution of that proposal. The assistant then proceeds with argument estimation for the planned node. The simulation enters the assistant's history as a response, while external state remains unaffected by the extra proposal. The mechanism aims to keep a competing instruction from being absorbed into the parameters of the genuine operation.
This mechanism uses instruction following in a different way from a prompt that simply asks the assistant to ignore everything resembling a command. It gives the assistant a place to put a proposed extra operation and lets the runtime control its consequences. The distinction between a simulated result and a real tool result matters most at that boundary. A real operation can change what the external system records. In the simulation, the only intended change is to the context the assistant sees before it resumes the user task.
The authors treat the rationale as behavioral and examine it through ablation. Simulation may help the assistant return to the original task after acknowledging a competing instruction internally. It still depends on the assistant presenting the competing request as a separate proposal in the first place. If an argument is selected improperly without that separation, the fact that a simulated path exists supplies no independent validation of the chosen value. The experiment therefore asks how much protection the mechanism adds in practice.
Experiments and results
Benchmark tasks and scoring
AgentDojo supplies stateful simulations of Workspace, Slack, Travel, and Banking. The paper reports 97 user tasks and 629 security test cases. An individual security case combines a user task with injected content and an attacker goal. The benchmark supports workflows with up to 18 tool calls per task, giving the assistant opportunities to interpret several successive responses before finishing. That matters for a method whose intervention is where one operation supplies information to another.
A user task and a security case serve different roles in the evaluation. The task defines the legitimate objective. A security case tests whether that objective can still be achieved when the assistant encounters injected material and whether the attacker achieves a separate goal. A difference in completion rates can therefore come from difficulty with the original work, disruption introduced by the injected content, or behavior introduced by the defense. Reporting an unattacked condition helps readers interpret those possibilities.
The main benchmark uses GPT-4o-mini for the comparison across defenses, domains, and attack conditions. The broader experiment also uses GPT-4o, Claude 3.5 Sonnet, and Qwen2.5-7B-Instruct among the backends the authors group as non-reasoning. The reasoning group contains Qwen3-32B and OpenAI o4-mini. The broader comparison in the paper's figure uses Important Instruction. The appendix gives exact versions for several backends, sets decoding temperature to 0 throughout, and uses a medium reasoning effort where applicable unless stated otherwise.
The attacks in the main comparison are Ignore Previous, InjecAgent, Tool Knowledge, and Important Instruction. These are named evaluation conditions, and the comparison asks how defenses fare under each. The differences among conditions matter because performance under a single one can give an incomplete account of how a defense handles the benchmark. The paper presents results for each condition before averaging, making it possible to identify which rankings recur and which depend on what the assistant encounters.
The undefended assistant supplies the reference for normal operation. Detector classifies retrieved responses and ends execution if it identifies an injection. Tool Filter uses the user goal to restrict the available tools. Spotlight marks the boundaries of returned content and asks the assistant to disregard instructions within it. Sandwich repeats the user goal after each tool call. These comparisons cover systems that intervene through screening, tool availability, or framing of the evidence. They also expose differing ways a defense can affect legitimate work.
Benign Utility, or BU, is the percentage of user tasks the assistant completes without injected content. Utility under Attack, or UA, is the percentage of security cases in which the original user task is completed. Targeted Attack Success Rate, or ASR, is the percentage of security cases that satisfy the attacker goal. Higher utility is desirable and lower attack success is desirable. A case can contribute to both UA and ASR if both objectives are achieved. The measures answer separate questions, so an improvement in one does not determine the other.
For example, an assistant that stops after encountering suspicious content can keep an unwanted operation from happening. If it also leaves the user task incomplete, the security outcome and the utility outcome diverge. A second assistant might finish the task and perform an extra operation, giving a different combination of outcomes. The paper uses the paired scores to judge defenses on how often they preserve service and on how often they prevent the targeted effects.
Average performance and differences among attacks
The overall GPT-4o-mini averages show IPIGuard at 0.69% ASR and 58.77% UA. Tool Filter, the defense with the next lowest average ASR, reports 2.06% ASR and 53.36% UA. Spotlight reports 11.31% ASR and 55.09% UA, the next highest average utility among the listed settings. The two averages for the undefended assistant are 13.16% ASR and 54.30% UA. On this comparison, IPIGuard leads on both measures.
Defenses on AgentDojo, average targeted attack success with GPT-4o-mini
IPIGuard records the lowest average rate of achieved attacker goals.
The numbers
| System or setting | ASR % |
|---|---|
| No defense | 13.16 |
| Detector | 4.43 |
| Tool Filter | 2.06 |
| Spotlight | 11.31 |
| Sandwich | 5.25 |
| IPIGuard (this paper) | 0.69 |
Defenses on AgentDojo, average utility under attack with GPT-4o-mini
IPIGuard completes the largest share of user tasks across the attack conditions.
The numbers
| System or setting | UA % |
|---|---|
| No defense | 54.30 |
| Detector | 26.50 |
| Tool Filter | 53.36 |
| Spotlight | 55.09 |
| Sandwich | 44.01 |
| IPIGuard (this paper) | 58.77 |
The Detector row shows why it matters to read the two charts together. The defense reduces targeted success relative to the undefended reference, and utility also falls substantially. Its decision to abort gives a plausible architectural explanation for why successful screening and successful task completion can come apart. The benchmark establishes the outcomes for the whole defense. The averages leave open how much of the lost utility came from stopping genuinely compromised tasks and how much came from other cases where work could have continued.
Under Important Instruction, the undefended assistant has 27.19% overall ASR and 49.92% UA. IPIGuard reports 0.64% ASR and 57.07% UA in the same condition. Tool Filter reports 4.93% ASR and 55.17% UA. Spotlight's ASR is 22.26%, compared with 2.54% under Ignore Previous. That spread makes the choice of evaluation condition important. A low result on Ignore Previous alone would give a different impression of Spotlight from the full comparison.
Under Ignore Previous, IPIGuard records 0.64% overall ASR and 61.21% UA. The undefended assistant's utility is 61.37%, with 3.97% ASR. Under InjecAgent, IPIGuard reports 0.32% ASR and 61.84% UA. The undefended assistant reaches 64.54% UA with 5.09% ASR. The comparison therefore includes conditions in which the undefended assistant completes more user tasks. IPIGuard's advantage in average UA does not require it to lead in utility for every condition.
Under Tool Knowledge, IPIGuard has 0.95% overall ASR and 60.57% UA. Tool Filter also reports 0.95% ASR in that condition, with 55.80% UA. The undefended assistant reports 10.33% ASR and 53.90% UA. The paper describes IPIGuard as achieving the lowest rate across the individual attacks. At the precision shown in the table, Tool Knowledge is a tie on overall ASR. Across the attack-level overall rows, all the reported IPIGuard attack success rates are below 1%.
Domain results and benign utility
The overall rows also conceal differences among domains. Averaged across the attacks, IPIGuard reports 67.71% UA in Workspace and 57.86% in Slack. In Travel the corresponding figure is 61.07%, and in Banking it is 48.44%. The lower Banking completion rate reflects the benchmark performance for that domain, even though IPIGuard improves on the Banking reference of 38.37% UA without a defense. The strongest defense in a group can still leave substantial legitimate work unfinished.
Average ASR for IPIGuard is 0.31% in Workspace, 0.71% in Slack, 0.00% in Travel, and 1.74% in Banking. In the Ignore Previous test specifically, Banking has 2.78% ASR with IPIGuard and 0.69% with Tool Filter. Under Tool Knowledge, the same Banking ASR figures are 2.78% for IPIGuard and 2.08% for Tool Filter. These cells locate residual exposure that is easy to miss in the attack-level overall rates. Travel's observed 0.00% average describes outcomes within that domain's cases.
Workspace offers a useful utility comparison. Without a defense, average Workspace UA is 74.90%. IPIGuard reaches 67.71% UA there while recording a lower Workspace ASR than the undefended condition, whose average is 5.73%. Travel shows a different pattern. IPIGuard reports 61.07% Travel UA, compared with 48.93% without a defense. Domain-level results reveal where the restrictions carry a visible completion cost and where the planned workflow can preserve more of the original work under attack.
On unattacked tasks, the main benign comparison reports 67.01% BU for IPIGuard and 68.04% for the undefended assistant. The authors identify 67.01% as the strongest benign result among the tested defenses in that comparison. They describe particularly strong performance in Travel and Banking. They attribute the somewhat weaker Workspace showing to conservative treatment of tasks that ask the assistant to take concrete actions based on tool responses. That interpretation is consistent with the architecture's policy on adding commands.
The component study gives 69.07% BU for the configuration with both additions enabled, while the main benign comparison gives 67.01% BU for IPIGuard. Each value belongs to its own reported evaluation. The paper does not give a reconciliation for the discrepancy, so treating either figure as a correction to the other would require evidence beyond the reported results.
The broader backend comparison tests IPIGuard with Important Instruction across the authors' reasoning and non-reasoning groups. They report that it prevents most targeted successes across those settings with comparatively small utility losses. The headline figures from the main table are specific to GPT-4o-mini. That table supports finer comparisons by attack and domain, while the broader figure addresses whether the pattern extends beyond the backend used for the detailed baseline study.
Execution time and token use
The GPT-4o-mini overhead test uses Important Instruction. IPIGuard averages 14,605 input tokens, 560 output tokens, and 13.88 seconds per task. Without a defense, the corresponding means are 6,165 input tokens, 179 output tokens, and 7.13 seconds. The input and output counts describe the communication required by the configuration. The time measurement also captures work outside the main assistant queries, which matters because some defenses add a separate processing step.
Tool Filter averages 4,616 input tokens and 5.98 seconds in this test. Spotlight averages 7,601 input tokens and 7.73 seconds. Detector is more expensive in time, at 23.19 seconds, with 19,385 input tokens. Sandwich averages 107,079 input tokens and 65.93 seconds. These figures give context to IPIGuard's overhead. It takes longer than the undefended reference and the faster defenses in this test, while some other configurations require still more time or input.
The usage figures matter to the paper's design argument because planning is a distinct stage. The authors estimate that planning typically accounts for about 20% of token use. Execution still includes the work of traversing the graph, interpreting responses, and managing missing information. If a stronger planner produces a more useful graph, IPIGuard can capture some of that benefit without assigning the same backend to all the subsequent work. The planner comparison tests how much that division helps in practice.
What the ablations show
Which work is done by the graph and which by the additions
The component study uses GPT-4o-mini, with Important Instruction for the attacked condition. It varies Fake Tool Invocation and Node Expansion while retaining the graph-based execution approach. For each combination, the authors report benign utility on unattacked tasks and both utility and targeted success on the security cases. This arrangement shows how the mechanisms behave by themselves and in combination within the same attack setting.
With both additions disabled, the paper reports 52.58% BU, 42.13% UA, and 3.18% ASR. The undefended comparison under Important Instruction, reported in the main results, has 27.19% ASR. The low targeted success rate for the reduced graph version supports the authors' claim that constraining execution already does substantial defensive work. Its utility figures give the other side of the result. A graph that is hard to extend can leave an assistant without the steps it needs to complete a legitimate task.
This comparison does not isolate every choice involved in graph execution. The reduced version still plans before reading external responses, traverses the dependencies, and resolves open arguments. The difference from the undefended assistant therefore covers a package of changes. The controlled component comparisons distinguish the contributions of Node Expansion and Fake Tool Invocation within that package. The graph-only result establishes a reference for asking what each addition buys.
IPIGuard component settings on AgentDojo, utility under Important Instruction
The configuration with both additions completes the largest share of user tasks.
The numbers
| System or setting | UA % |
|---|---|
| Both additions disabled | 42.13 |
| Node Expansion only | 52.46 |
| Fake Tool Invocation only | 49.76 |
| Both additions enabled (this paper) | 57.07 |
With Node Expansion alone, benign utility reaches 64.95% and attacked utility reaches 52.46%. Targeted attack success is 4.77%. In comparison with the setting where both additions are disabled, these scores show the value of allowing extra reads. A task whose plan omitted a necessary lookup can still succeed. The higher ASR also establishes that the expanded capability affects the security measure, in spite of being restricted to reads.
The authors attribute part of that security increase to cases where AgentDojo scores a read-only interaction as satisfying the attacker goal. They give visits to attacker-specified sites as an example and judge such behaviors to have limited practical impact in the studied setting. The benchmark uses its own success criterion, and the higher observed ASR belongs in the result. A read can satisfy a targeted benchmark objective without producing the same kind of consequence as an unauthorized command. The score records goal achievement and leaves the severity of individual events to further interpretation.
With Fake Tool Invocation alone, the study reports 51.55% BU, 49.76% UA, and 0.32% ASR. Compared with the setting that disables both additions, utility improves in the presence of injected content while targeted success falls. Benign utility is slightly lower. That pattern is consistent with the proposed role of simulation. When a competing instruction would otherwise influence how a pending node is filled, routing a proposed extra operation into a simulation can preserve both the intended operation and its inputs. The aggregate results show the effect on outcomes. They give less detail about where individual value-selection decisions were corrected.
When both mechanisms are enabled, the reported scores are 69.07% BU, 57.07% UA, and 0.64% ASR. This configuration has the best benign and attacked utility among the ablation settings. Fake Tool Invocation on its own has the lowest ASR in that comparison. The comparison reveals a concrete tradeoff within IPIGuard. The more restrictive setting reduces targeted success further, while the setting that can recover missing information completes more user tasks.
Looking at the paired comparisons makes the complementarity clearer. With expansion already enabled, adding simulation moves ASR from 4.77% to 0.64%, and UA from 52.46% to 57.07%. With simulation already enabled, adding expansion moves ASR from 0.32% to 0.64%, and UA from 49.76% to 57.07%. The effect of expansion on task completion persists in the presence of simulation. The effect of simulation on targeted success persists in the presence of expansion. The two changes address distinct points where a rigid graph or an incorrect argument can prevent the intended outcome.
How much depends on the planner
The planner comparison varies which backend creates the graph and which one executes it. This changes the quality of the proposed operations and dependencies while allowing the same executor to be compared across plans. The results use AgentDojo, with Important Instruction for the attacked conditions. The reported cost is an estimate for completing the full task set, so it describes the configuration in the study rather than a price for an individual user request.
With Qwen2.5-7B-Instruct executing, the same backend as planner yields 35.05% BU and 33.55% UA. Replacing the planner with o4-mini gives 51.55% BU and 49.28% UA. ASR also moves from 0.16% to 3.66% in this comparison. The utility gain is substantial in the reported results, and the very low ASR of the original pairing needs to be read alongside its completion rates. A configuration that rarely completes the legitimate workflow may also offer fewer opportunities for the attacker to reach a goal. The table records what happened without attributing that particular security difference to a single cause.
With GPT-4o-mini executing, using the same backend for planning yields 57.07% UA at an estimated total cost of $6.73. Using o4-mini to plan gives 64.39% UA at $7.99. The latter pairing reports 64.95% BU and 1.11% ASR, compared with 69.07% BU and 0.64% ASR when GPT-4o-mini fills both roles. In this example, the more expensive planner improves attacked utility while the identical-backend pairing has better benign utility and a lower measured ASR. Whether the planner change improves performance depends on which outcome is being compared.
With GPT-4o as the executor and o4-mini as the planner, the paper reports 72.66% UA, the highest attacked utility among the pairings shown. Using GPT-4o for both roles reports 69.48% UA and 75.26% BU. These comparisons support the authors' view that the use of a capable executor leaves room for a better plan to help. They also show why planner choice belongs in accounts of the method's performance. A more complete or better ordered plan can change what the runtime is authorized and able to do, and different graph choices can affect security as well as completion.
The authors interpret stronger planning as producing better-structured subgoals. The comparison identifies a useful intervention, since the executor can stay fixed while the plan changes. The table evaluates outputs of the whole system, so it leaves open which defects account for most of the difference. A plan might omit a necessary lookup, set an argument poorly, or make a later operation depend on the wrong response. Those are distinct ways for imperfect planning to affect traversal. The reported completion scores measure their combined consequence.
Limitations
Limits the authors identify
The paper confines its defense to prompt injections that interfere with tool use. An injected passage can also affect a purely textual answer. For instance, a response can give the user a misleading account of the results even when the assistant never invokes an unauthorized tool. The authors put that outcome outside their main evaluation and argue that it presents less practical risk in the tool-centered settings they study. Their evidence addresses the integrity of the tool workflow and its benchmarked outcomes. It supplies little basis for judging the accuracy or integrity of the final prose under injection.
The authors identify the cost of querying the tested backends as a constraint on experimental scale. They specifically name OpenAI o3 as an example outside the evaluation. The deliberate mix of reasoning and non-reasoning backends widens the evidence compared with a single-backend experiment. The most detailed comparisons still use GPT-4o-mini, and the cross-backend figure centers on Important Instruction. The paper's claims are therefore strongest for the combinations of defenses, execution arrangements, and security cases it actually evaluates.
The method also depends on having a planner with adequate capability. The initial graph determines which calls will be available for tasks requiring commands. If the plan omits a necessary command, the query expansion policy cannot add it later. A graph can also misrepresent which evidence supports a pending operation. The planner comparison shows that choices made at this stage have substantial consequences for utility. This dependency matters wherever the strongest configuration in the study is unavailable or costs more than the application can support.
The authors acknowledge residual failures associated with Fake Tool Invocation. In the main evaluation, IPIGuard's attack rates are low and positive overall. The proposed explanation is that the simulation can fail in corner cases, which the authors leave for future investigation. This matters because simulation is a technique for influencing how pending arguments are chosen. The external operation still depends on the eventual choice of those values.
The authors also identify the case where a user delegates decisions about concrete actions to material the assistant will read. Their conservative policy makes some work of this kind harder to complete, and they connect that choice to the Workspace results. A system that preauthorizes particular commands can support a condition on retrieved facts, as in the hotel reminder. It faces a different task when the retrieved material is expected to supply the commands themselves. The paper accepts a utility cost in that setting.
Limits a reader can see in the setup
The graph's value depends on a trust boundary that has already been decided when planning begins. The planner is allowed to see trusted system context and user-designated material. The design gains its protection against later responses by putting those responses on the execution side of the boundary. The experiments measure attacks encountered through tool interaction in the benchmark. They leave the reliability of the initial assignment of trust to particular inputs as a separate question.
The meaning of a read-only operation also depends on the tool interface and on what counts as a security consequence. IPIGuard's expansion rule relies on being able to designate an operation as a query. The paper justifies this by contrasting an information request with changes to external records or transactions. Yet the ablation itself shows that the benchmark can award targeted success to a read. Even when a lookup leaves a stored record untouched, reaching an external destination or collecting data can matter to a security policy. The graph approach inherits the capability distinctions exposed by the tools and the outcome distinctions made by the evaluator.
The representation of pending arguments creates another boundary. The method records which parts of a call are already fixed and which can be filled from retrieved content. It can keep a known field intact and constrain the type of an unknown field. The connection from a source response to a slot in a command still needs semantic interpretation. The experiment shows that simulation helps in some of the tested cases. It does not establish that every well-typed value drawn from an upstream response expresses the user's intent.
A graph can enforce a dependency even when the dependency is mistaken. Traversal can make sure that a predecessor runs before its successor, and the stage that builds the graph still decides which predecessor belongs there. This distinction matters when interpreting the authors' conclusion about verifiable systems. A structure creates an explicit object whose calls and edges can be inspected. Correctness of the plan, correctness of the data selected at execution, and faithful enforcement of the plan remain different claims. The paper's benchmark results address the combined operation of those stages.
The security metric records the achievement of named attacker goals. It allows a clean comparison within the test but does not grade the consequences of every step along the way. An unintended visit and an unintended write can both be important, and they can have different consequences in an application. The utility metric similarly records task completion and leaves room for differences in intermediate behavior. These characteristics explain why the paper's examples add context to the percentages and why low average ASR does not settle the significance of a particular failure.
The tested benchmark is also a simulation of stateful applications. Its domains, multiple calls, and separate goals make it relevant to the problem the authors pose. The results describe what happened with those tasks and available tools. The earlier work on adaptive attacks motivates the search for structural protections. The reported experimental comparison concerns the named AgentDojo conditions. It provides evidence of robustness there, with unresolved questions about how the design would fare under an evaluation adapted specifically to its graph, its expansion policy, or its argument resolution.
Finally, the cost results belong to particular backend assignments and an attack test with particular workflows. The paper shows that separating planner from executor can improve attacked utility at a modest additional estimated cost in a reported pairing. Other pairings show different changes in benign utility and ASR. For an application with a different balance of lookups, pending operations, or independent calls, the distribution of work between planning and execution could differ. The method makes that distribution a design variable. The experiments characterize several choices without establishing a universally best allocation.
What came after
ToolSafe cites IPIGuard and takes up tool invocation safety through proactive checks and feedback at individual steps. Its title places the intervention around each proposed invocation. IPIGuard places its main authorization decision earlier, when the dependency graph is built, then uses execution-time mechanisms to handle missing information and competing instructions within that plan.
This is a continuation of the question IPIGuard raises about where to intervene in a tool-using workflow. A planned graph gives the runtime a basis for deciding whether an operation was authorized when the user task was interpreted. Step-level feedback takes the individual invocation as the point where a guardrail can intervene. The citation establishes the connection between the papers, and ToolSafe's stated scope identifies that shift in emphasis. The citation alone does not establish that ToolSafe reuses the dependency graph, adopts the simulated-completion mechanism, or reports comparable AgentDojo outcomes.
Cite
Cite as Hengyu An, Jinghuai Zhang, Tianyu Du, Chunyi Zhou, Qingming Li, Tao Lin and Shouling Ji. 2025. IPIGuard: A Novel Tool Dependency Graph-Based Defense Against Indirect Prompt Injection in LLM Agents. Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing.
@inproceedings{an2025ipiguard,
title = {{IPIGuard: A Novel Tool Dependency Graph-Based Defense Against Indirect Prompt Injection in LLM Agents}},
author = {Hengyu An, Jinghuai Zhang, Tianyu Du, Chunyi Zhou, Qingming Li, Tao Lin and Shouling Ji},
booktitle = {Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing},
year = {2025},
doi = {10.18653/v1/2025.emnlp-main.53},
url = {https://doi.org/10.18653/v1/2025.emnlp-main.53}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/an-2025-ipiguard-novel-tool-dependency-graph/