AgentWatcher: A Rule-based Prompt Injection Monitor
On the map: LLM safety and security → Prompt injection and agent security
Abstract (arXiv)
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.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Placed in Prompt injection and agent security, one of 12 directions in LLM safety and security. Builds on 53 of its 81 references that are in the map. First posted on arXiv 1 Apr 2026.
Builds on
53 of 81 references.
Closest ancestors · 23
Same direction, newest first
- 2026AgentDoG: A Diagnostic Guardrail Framework for AI Agent Safety and Security26 Jan
- 2025PISanitizer: Preventing Prompt Injection to Long-Context LLMs via Prompt Sanitization13 Nov
- 2025Defending Against Prompt Injection with DataFilter22 Oct
- 2025PIShield: Detecting Prompt Injection Attacks via Intrinsic LLM Features15 Oct
- 2025PromptLocate: Localizing Prompt Injection Attacks14 Oct
- 2025PromptArmor: Simple yet Effective Prompt Injection Defenses21 Jul
- 2025DRIFT: Dynamic Rule-Based Defense with Injection Isolation for Securing LLM Agents13 Jun
- 2025A Critical Evaluation of Defenses against Prompt Injection Attacks23 May
- 2025WASP: Benchmarking Web Agent Security Against Prompt Injection Attacks22 Apr
- 2025Progent: Securing AI Agents with Privilege Control16 Apr
- 2025DataSentinel: A Game-Theoretic Detection of Prompt Injection Attacks15 Apr
- 2025Defeating Prompt Injections by Design24 Mar
11 more
- 2025PromptShield: Deployable Detection for Prompt Injection Attacks25 Jan
- 2024Attention Tracker: Detecting Prompt Injection Attacks in LLMs1 Nov
- 2024InjecGuard: Benchmarking and Mitigating Over-defense in Prompt Injection Guardrail Models30 Oct
- 2024SecAlign: Defending Against Prompt Injection with Preference Optimization7 Oct
- 2024System-Level Defense against Indirect Prompt Injection Attacks: An Information Flow Control Perspective27 Sep
- 2024AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents19 Jun
- 2024Get my drift? Catching LLM Task Drift with Activation Deltas2 Jun
- 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions19 Apr
- 2024Automatic and Universal Prompt Injection Attacks against Large Language Models7 Mar
- 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents5 Mar
- 2024StruQ: Defending Against Prompt Injection with Structured Queries9 Feb
Other references · 30
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
- 2025Qwen3 Technical Reportcited by 8,820
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,754
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2023WebArena: A Realistic Web Environment for Building Autonomous Agentscited by 2,006
- 2023Jailbreaking Black Box Large Language Models in Twenty Queriescited by 1,420
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,417
- 2025OpenAI GPT-5 System Cardcited by 989
- 2023H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Modelscited by 832
- 2023Tree of Attacks: Jailbreaking Black-Box LLMs Automaticallycited by 672
18 more
- 2019Attention is not not Explanationcited by 636
- 2023Enabling Large Language Models to Generate Text with Citationscited by 595
- 2021A Dataset of Information-Seeking Questions and Answers Anchored in Research Paperscited by 486
- 2019Is Attention Interpretable?cited by 389
- 2021Efficient Attentions for Long Document Summarizationcited by 345
- 2025The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against Llm Jailbreaks and Prompt Injectionscited by 129
- 2025Securing AI Agents with Information-Flow Controlcited by 121
- 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 112
- 2024ContextCite: Attributing Model Generation to Contextcited by 98
- 2025Prompt Flow Integrity to Prevent Privilege Escalation in LLM Agentscited by 87
- 2026AgentDyn: Are Your Agent Security Defenses Deployable in Real-World Dynamic Environments?cited by 59
- 2025RLVR-World: Training World Models with Reinforcement Learningcited by 40
- 2026From Assistant to Double Agent: Formalizing and Benchmarking Attacks on OpenClaw for Personalized Local AI Agentcited by 29
- 2026Don't Let the Claw Grip Your Hand: A Security Analysis and Defense Framework for OpenClawcited by 29
- 2026A Trajectory-Based Safety Audit of Clawdbot (OpenClaw)cited by 16
- 2025Learning to Attribute with Attentioncited by 13
- 2025TracLLM: A Generic Framework for Attributing Long Context LLMscited by 13
- 2026The Why Behind the Action: Unveiling Internal Drivers via Agentic Attributioncited by 11
Built on by
Citing papers per year: 2026: 6.
6 papers.
- 2026Trust No Tool: Evaluating and Defending LLM Agents under Untrusted Tool Feedbackcited by 2
- 2026ContainmentBench: Trace-Based Evaluation of Post-Exposure Containment in Tool-Using LLM Agentscited by 1
- 2026Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teamingcited by 1
- 2026Influence Is Not Authority: When Causal Guardrail Signals Make Legitimate Tool Use Look Like an Attack in Tool-Using LLM Agentscited by 1
- 2026Beyond Pattern Matching: Seven Cross-Domain Techniques for Prompt Injection Detectioncited by 0
- 2026A Proposal for an Agentic AI Architecture to Support Multi-Domain Decision-Making in the Brazilian Armed Forcescited by 0
- 2026A Proposal for an Agentic AI Architecture to Support Multi-Domain Decision-Making in the Brazilian Armed Forces17 Sep 2026
- 2026Influence Is Not Authority: When Causal Guardrail Signals Make Legitimate Tool Use Look Like an Attack in Tool-Using LLM Agents30 Aug 2026
- 2026Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teaming5 Aug 2026
- 2026ContainmentBench: Trace-Based Evaluation of Post-Exposure Containment in Tool-Using LLM Agents27 Jul 2026
- 2026Trust No Tool: Evaluating and Defending LLM Agents under Untrusted Tool Feedback17 May 2026
- 2026Beyond Pattern Matching: Seven Cross-Domain Techniques for Prompt Injection Detection20 Apr 2026
Similar, not cited
Close in wording, no citation either way
- 2026ARGUS: Defending LLM Agents Against Context-Aware Prompt Injection
- 2025PromptSleuth: Detecting Prompt Injection via Semantic Intent Invariance
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysis
- 2025Mitigating Indirect Prompt Injection via Instruction-Following Intent Analysis
- 2026AgentSentry: Mitigating Indirect Prompt Injection in LLM Agents via Temporal Causal Diagnostics and Context Purification
- 2026PVDetector: Detecting Prompt Injection Attacks on Purpose-Specific LLM Agents through Policy-Violation Concept Analysis
- 2025AgentVigil: Generic Black-Box Red-teaming for Indirect Prompt Injection against LLM Agents
- 2026Prompted to Discriminate: Generalizing Malicious-Input Probes in the Wild