AgentWatcher: Een op regels gebaseerde monitor voor promptinjectie
AgentWatcher: A Rule-based Prompt Injection Monitor
April 1, 2026
Auteurs: Yanting Wang, Wei Zou, Runpeng Geng, Jinyuan Jia
cs.AI
Samenvatting
Grote taalmodellen (LLM's) en hun toepassingen, zoals agents, zijn zeer kwetsbaar voor prompt injection-aanvallen. State-of-the-art methoden voor het detecteren van prompt injection hebben de volgende beperkingen: (1) hun effectiviteit neemt significant af naarmate de contextlengte toeneemt, en (2) ze ontberen expliciete regels die definiëren wat als prompt injection wordt beschouwd, waardoor detectiebeslissingen impliciet, ondoorzichtig en moeilijk te beredeneren zijn. In dit werk stellen we AgentWatcher voor om de bovenstaande twee beperkingen aan te pakken. Om de eerste beperking aan te pakken, schrijft AgentWatcher de output van het LLM (bijvoorbeeld de actie van een agent) toe aan een kleine set causaal invloedrijke contextsegmenten. Door de detectie te richten op een relatief korte tekst, kan AgentWatcher schaalbaar zijn voor lange contexten. Om de tweede beperking aan te pakken, definiëren we een set regels die specificeren wat wel en niet als prompt injection wordt beschouwd, en gebruiken we een monitor-LLM om over deze regels te redeneren op basis van de toegeschreven tekst, waardoor de detectiebeslissingen beter verklaarbaar worden. We voeren een uitgebreide evaluatie uit op benchmarks voor tool-use agents en datasets voor lang-contextbegrip. De experimentele resultaten tonen aan dat AgentWatcher effectief prompt injection kan detecteren en de functionaliteit kan behouden zonder aanvallen. De code is beschikbaar op https://github.com/wang-yanting/AgentWatcher.
English
Large language models (LLMs) and their applications, such as agents, are highly vulnerable to prompt injection attacks. State-of-the-art prompt injection detection methods have the following limitations: (1) their effectiveness degrades significantly as context length increases, and (2) they lack explicit rules that define what constitutes prompt injection, causing detection decisions to be implicit, opaque, and difficult to reason about. In this work, we propose AgentWatcher to address the above two limitations. To address the first limitation, AgentWatcher attributes the LLM's output (e.g., the action of an agent) to a small set of causally influential context segments. By focusing detection on a relatively short text, AgentWatcher can be scalable to long contexts. To address the second limitation, we define a set of rules specifying what does and does not constitute a prompt injection, and use a monitor LLM to reason over these rules based on the attributed text, making the detection decisions more explainable. We conduct a comprehensive evaluation on tool-use agent benchmarks and long-context understanding datasets. The experimental results demonstrate that AgentWatcher can effectively detect prompt injection and maintain utility without attacks. The code is available at https://github.com/wang-yanting/AgentWatcher.