Design Patterns for Securing LLM Agents against Prompt Injections

Agent Agent Planning Tool Learning AI Safety / AI Ethics PIAAP
2025年06月10日
随着由大语言模型(LLM)驱动的 AI 代理变得越来越多样化,能够处理广泛的任务,确保其安全性已成为一个关键挑战。其中最紧迫的威胁之一是提示注入攻击(prompt injection attacks),这类攻击利用了代理对自然语言输入的处理机制——当代理被授予工具访问权限或处理敏感信息时,这一威胁尤为危险。在本研究中,我们提出了一组基于原则的设计模式,用于构建具备可证明抵御提示注入能力的 AI 代理。我们对这些设计模式进行了系统分析,讨论了它们在实用性与安全性之间的权衡,并通过一系列案例研究展示了其在现实世界中的应用价值。
As AI agents powered by Large Language Models (LLMs) become increasingly versatile and capable of addressing a broad spectrum of tasks, ensuring their security has become a critical challenge. Among the most pressing threats are prompt injection attacks, which exploit the agent's resilience on natural language inputs -- an especially dangerous threat when agents are granted tool access or handle sensitive information. In this work, we propose a set of principled design patterns for building AI agents with provable resistance to prompt injection. We systematically analyze these patterns, discuss their trade-offs in terms of utility and security, and illustrate their real-world applicability through a series of case studies.
许愿