增加每章节 README 文件

This commit is contained in:
2026-09-22 15:57:59 +08:00
parent 8e86665096
commit 9445061c76
49 changed files with 3815 additions and 6 deletions
@@ -0,0 +1,54 @@
# 安全与对齐
> 所属:阶段五 · 进阶技术
> 目标:掌握 Agent 的注入防护、工具权限、输出审计、Human-in-the-loop 高危节点审批。
---
## 📌 学习目的
掌握 Agent 的注入防护、工具权限、输出审计、Human-in-the-loop 高危节点审批。
## ✅ 学习要求(前置条件)
已完成阶段四「01_tool_calling_ecosystem」。
## 📚 主要学习内容
- 提示词注入:间接诱导 / 越权指令 / 身份混淆
- 工具权限:白名单 + 角色 + 代码层拦截
- 输出审计:危险动作必须可追溯、可回滚
- Human-in-the-loop:高危节点 interrupt 审批
## 📖 对应 docs
- 目录:[`docs/05-阶段五-进阶技术/`](../../docs/05-阶段五-进阶技术/)(按目录名里的 `第 X 篇` 对应)
- 在 docs 目录里找到对应的小点 markdown 文件阅读详细理论。
## 🛠️ 建议练习
- [ ] 为一个 Agent 写一个注入测试集(10 个 bad prompt)
- [ ] 为「转账」类工具加 Human-in-the-loop 审批
- [ ] 实现一个工具调用审计日志模块
## 🏁 完成后达成标准
- [ ] 能识别主流的提示词注入攻击并防护
- [ ] 能设计高危工具的审批闸门
- [ ] 能写出可追溯的工具调用审计日志
---
## 🚀 运行提示
```bash
# 激活根目录的虚拟环境
cd /Users/jack/source/Demo/py/demo_python_agent
source .venv/bin/activate # 或直接用 uv run ...
# 进入本章目录
cd code/005_phase5_advanced/05_safety_and_alignment
# 跑你的练习文件
uv run python your_exercise.py
```