AgentSys: Secure and Dynamic LLM Agents Through Explicit Hierarchical Memory Management
On the map: LLM agents and tool use → Agent threats, guardrails and governance
also in 1 more
Abstract (arXiv)
Indirect prompt injection threatens LLM agents by embedding malicious instructions in external content, enabling unauthorized actions and data theft. LLM agents maintain working memory through their context window, which stores interaction history for decision-making. Conventional agents indiscriminately accumulate all tool outputs and reasoning traces in this memory, creating two critical vulnerabilities: (1) injected instructions persist throughout the workflow, granting attackers multiple opportunities to manipulate behavior, and (2) verbose, non-essential content degrades decision-making capabilities. Existing defenses treat bloated memory as given and focus on remaining resilient, rather than reducing unnecessary accumulation to prevent the attack. We present AgentSys, a framework that defends against indirect prompt injection through explicit memory management. Inspired by process memory isolation in operating systems, AgentSys organizes agents hierarchically: a main agent spawns worker agents for tool calls, each running in an isolated context and able to spawn nested workers for subtasks. External data and subtask traces never enter the main agent's memory; only schema-validated return values can cross boundaries through deterministic JSON parsing. Ablations show isolation alone cuts attack success to 2.19%, and adding a validator/sanitizer further improves defense with event-triggered checks whose overhead scales with operations rather than context length. On AgentDojo and ASB, AgentSys achieves 0.78% and 4.25% attack success while slightly improving benign utility over undefended baselines. It remains robust to adaptive attackers and across multiple foundation models, showing that explicit memory management enables secure, dynamic LLM agent architectures. Our code is available at: https://github.com/ruoyaow/agentsys-memory.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 46 of its 59 references that are in the map. First posted on arXiv 7 Feb 2026.
Builds on
46 of 59 references.
Closest ancestors · 13
Same direction, newest first
- 2025IPIGuard: A Novel Tool Dependency Graph-Based Defense Against Indirect Prompt Injection in LLM Agents21 Aug
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injection2 Aug
- 2025PromptArmor: Simple yet Effective Prompt Injection Defenses21 Jul
- 2025DRIFT: Dynamic Rule-Based Defense with Injection Isolation for Securing LLM Agents13 Jun
- 2025Simple Prompt Injection Attacks Can Leak Personal Data Observed by LLM Agents During Task Execution1 Jun
- 2025Progent: Securing AI Agents with Privilege Control16 Apr
- 2025Defeating Prompt Injections by Design24 Mar
- 2025Adaptive Attacks Break Defenses Against Indirect Prompt Injection Attacks on LLM Agents27 Feb
- 2025RTBAS: Defending LLM Agents Against Prompt Injection and Privacy Leakage13 Feb
- 2025MELON: Provable Defense Against Indirect Prompt Injection Attacks in AI Agents7 Feb
- 2024Agent Security Bench (ASB): Formalizing and Benchmarking Attacks and Defenses in LLM-based Agents3 Oct
- 2024EIA: Environmental Injection Attack on Generalist Web Agents for Privacy Leakage17 Sep
Other references · 33
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
- 2023A Survey on Large Language Model based Autonomous Agentscited by 2,203
- 2023Jailbroken: How Does LLM Safety Training Fail?cited by 1,565
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,339
- 2023Jailbreaking Black Box Large Language Models in Twenty Queriescited by 1,326
- 2024OSWorld: Benchmarking Multimodal Agents for Open-Ended Tasks in Real Computer Environmentscited by 1,134
- 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 760
- 2023AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Modelscited by 738
- 2023Prompt Injection attack against LLM-integrated Applicationscited by 568
21 more
- 2024Understanding the planning of LLM agents: A surveycited by 414
- 2023A Real-World WebAgent with Planning, Long Context Understanding, and Program Synthesiscited by 350
- 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 325
- 2024Defending Against Indirect Prompt Injection Attacks With Spotlightingcited by 233
- 2024Jailbreak Attacks and Defenses Against Large Language Models: A Surveycited by 215
- 2025Large Language Model Agent: A Survey on Methodology, Applications and Challengescited by 194
- 2024SecAlign: Defending Against Prompt Injection with Preference Optimizationcited by 179
- 2025From LLM Reasoning to Autonomous AI Agents: A Comprehensive Reviewcited by 146
- 2025DataSentinel: A Game-Theoretic Detection of Prompt Injection Attackscited by 124
- 2025The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against Llm Jailbreaks and Prompt Injectionscited by 108
- 2024Found in the Middle: Calibrating Positional Attention Bias Improves Long Context Utilizationcited by 97
- 2024System-Level Defense against Indirect Prompt Injection Attacks: An Information Flow Control Perspectivecited by 91
- 2024Attention Tracker: Detecting Prompt Injection Attacks in LLMscited by 82
- 2023Evaluating the Instruction-Following Robustness of Large Language Models to Prompt Injectioncited by 53
- 2025ACE: A Security Architecture for LLM-Integrated App Systemscited by 52
- 2025Can Indirect Prompt Injection Attacks Be Detected and Removed?cited by 43
- 2024Defense Against Prompt Injection Attack by Leveraging Attack Techniquescited by 31
- 2025Defending Against Prompt Injection With a Few DefensiveTokenscited by 26
- 2025May I have your Attention? Breaking Fine-Tuning based Prompt Injection Defenses using Architecture-Aware Attackscited by 14
- 2025How Not to Detect Prompt Injections with an LLMcited by 11
- 2025Defense against Prompt Injection Attacks via Mixture of Encodingscited by 10
Built on by
Citing papers per year: 2026: 10.
10 papers.
- 2026The Verifier Tax: Horizon Dependent Safety Success Tradeoffs in Tool Using LLM Agentscited by 10
- 2026Auditing Provenance Sensitivity in LLM Agent Action Selectioncited by 9
- 2026SafeAgent: A Runtime Protection Architecture for Agentic Systemscited by 7
- 2026Safeguarding LLM Agents against Long-Horizon Threats via Shadow Memorycited by 6
- 2026Toward Secure LLM Agents: Threat Surfaces, Attacks, Defenses, and Evaluationcited by 5
- 2026Trust No Tool: Evaluating and Defending LLM Agents under Untrusted Tool Feedbackcited by 2
- 2026When Convenience Becomes Risk: A Semantic View of Under-Specification in Host-Acting Agentscited by 1
- 2026Security of OpenClaw Agents: Fundamentals, Attacks, and Countermeasurescited by 1
- 2026Ghost in the Context: Policy-Carriage Integrity in LLM Agentscited by 0
- 2026RT-SHCUA: Real-Time Self-Hosted Computer-Use Agent for UAV Controlcited by 0
- 2026Auditing Provenance Sensitivity in LLM Agent Action Selection23 Jul 2026
- 2026RT-SHCUA: Real-Time Self-Hosted Computer-Use Agent for UAV Control20 Jul 2026
- 2026Toward Secure LLM Agents: Threat Surfaces, Attacks, Defenses, and Evaluation9 Jun 2026
- 2026Security of OpenClaw Agents: Fundamentals, Attacks, and Countermeasures25 May 2026
- 2026Trust No Tool: Evaluating and Defending LLM Agents under Untrusted Tool Feedback17 May 2026
- 2026Safeguarding LLM Agents against Long-Horizon Threats via Shadow Memory4 May 2026
- 2026Ghost in the Context: Policy-Carriage Integrity in LLM Agents2 May 2026
- 2026SafeAgent: A Runtime Protection Architecture for Agentic Systems19 Apr 2026
- 2026When Convenience Becomes Risk: A Semantic View of Under-Specification in Host-Acting Agents22 Mar 2026
- 2026The Verifier Tax: Horizon Dependent Safety Success Tradeoffs in Tool Using LLM Agents18 Mar 2026
Similar, not cited
Close in wording, no citation either way
- 2026Injection-Execution Dissociation: A Mechanistic Evaluation of Persistent Memory Attacks and Defenses in Stateful LLM Agents
- 2026MemSecBench: Tracking Agent Memory Poisoning from Persistence to Consequence and Repair
- 2026From Storage to Steering: Memory Control Flow Attacks on LLM Agents
- 2025MemoryGraft: Persistent Compromise of LLM Agents via Poisoned Experience Retrieval
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injections
- 2026Bad Memory: Evaluating Prompt Injection Risks from Memory in Agentic Systems
- 2026MemLineage: Lineage-Guided Enforcement for LLM Agent Memory
- 2026Agentao: A Policy-Governed Runtime Harness for Embeddable Tool-Using LLM Agents