# 第七章 智能体与 RAG 安全

随着 LLM 被赋予工具调用能力和外部知识访问能力，系统的能力边界大幅扩展，但安全风险也随之增加。本章将深入分析智能体系统和 RAG 架构面临的独特安全挑战。

本章聚焦于智能体与 RAG 安全，主要内容包括：

* **7.1 智能体系统安全风险**：分析自主智能体的安全威胁模型
* **7.2 RAG 架构攻击面分析**：识别检索增强生成系统的漏洞
* **7.3 工具调用安全**：探讨函数调用和 API 集成的安全问题
* **7.4 智能体技能与生态安全**：分析插件市场与复合技能带来的供应链隐患
* **7.5 多智能体协作系统的安全架构**：分析多智能体环境中的信任链破坏、权限提升链和共享状态污染等新型威胁
* **7.6 Agents Rule of Two 与智能体安全设计原则**：探讨双层验证机制在自主代理系统中的应用

通过本章的学习，读者将理解复杂 LLM 系统的安全挑战和防护要点，掌握从单体智能体到多智能体协作系统的完整安全架构。

> **⚠️ 道德边界**：本章对工具调用滥用、RAG 中毒、多 Agent 信任链破坏的剖析用于让 Agent 开发者识别并修复自身系统的安全弱点；针对未经授权的他方 Agent 系统执行类似攻击违反法律与服务条款。完整声明见 [§4 章首道德边界与负责任披露说明](/ai_security_guide/di-er-bu-fen-gong-ji-pian/04_prompt_injection.md)。

```mermaid
flowchart LR
    subgraph "扩展能力与风险"
    A["智能体能力"] --> C["操作风险"]
    B["RAG 能力"] --> D["数据风险"]
    C --> E["系统安全威胁"]
    D --> E
    end
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeasy.gitbook.io/ai_security_guide/di-er-bu-fen-gong-ji-pian/07_agent_rag_security.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
