# agentic-design-patterns-cn **Repository Path**: corffee/agentic-design-patterns-cn ## Basic Information - **Project Name**: agentic-design-patterns-cn - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-17 - **Last Updated**: 2025-10-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/ginobefun-agentic-design-patterns-cn-badge.png)](https://mseep.ai/app/ginobefun-agentic-design-patterns-cn) # Agentic Design Patterns | 智能体设计模式 ## A Hands-On Guide to Building Intelligent Systems | 构建智能系统的实践指南 [![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc/4.0/) [![GitHub stars](https://img.shields.io/github/stars/ginobefun/agentic-design-patterns-cn)](https://github.com/ginobefun/agentic-design-patterns-cn/stargazers) [![GitHub forks](https://img.shields.io/github/forks/ginobefun/agentic-design-patterns-cn)](https://github.com/ginobefun/agentic-design-patterns-cn/network) **原书作者 (Author)**: [Antonio Gulli](https://www.linkedin.com/in/searchguy/) **原书链接 (Original Book)**: [Amazon](https://www.amazon.com/Agentic-Design-Patterns-Hands-Intelligent/dp/3032014018/) **原始文档链接 (Original Book Link)**: [Google Docs](https://docs.google.com/document/d/1rsaK53T3Lg5KoGwvf8ukOUvbELRtH-V0LnOIFDxBryE/preview?tab=t.0#heading=h.pxcur8v2qagu) --- ## 📖 项目简介 | Project Description 本项目是对 Antonio Gulli 所著《Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems》的**中英文对照翻译**。该书是一部全面的技术指南,涵盖了现代人工智能系统中智能体 (Agent) 设计的核心概念和实践方法。 This project is a **bilingual Chinese-English translation** of "Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems" by Antonio Gulli. The book is a comprehensive technical guide covering core concepts and practical approaches to agent design in modern AI systems. --- ## 🎯 项目特色 | Key Features - 📚 **中英文对照** - 完整的双语对照翻译 - 🎨 **高亮显示** - 中文内容使用黄色高亮,易于区分 - 📝 **格式规范** - 严格遵循 Markdown 标准和翻译规范 - 🔗 **代码链接** - 保留所有原书代码示例链接 - ⚡ **持续更新** - 逐章翻译,持续更新进度 --- ## 📋 目录 | Table of Contents **总页数:424 页** | **Total: 424 Pages** ### 前置内容 | Front Matter - [x] [献辞 | Dedication](01-Dedication.md) - [x] [致谢 | Acknowledgment](02-Acknowledgment.md) - [x] [序言 | Foreword](03-Foreword.md) - [x] [思想领袖的洞见:权力与责任 | A Thought Leader's Perspective: Power and Responsibility](04-Thought-Leader.md) - [x] [介绍 | Introduction](05-Introduction.md) - [x] [是什么让 AI 系统成为"智能体"? | What makes an AI system an "agent"?](06-What-Makes-Agent.md) ### 第一部分 | Part One (103 页) - [x] [第一章:提示链 | Chapter 1: Prompt Chaining](07-Chapter-01-Prompt-Chaining.md) - [x] [第二章:路由 | Chapter 2: Routing](08-Chapter-02-Routing.md) - [x] [第三章:并行化 | Chapter 3: Parallelization](09-Chapter-03-Parallelization.md) - [x] [第四章:反思 | Chapter 4: Reflection](10-Chapter-04-Reflection.md) - [ ] [第五章:工具使用 | Chapter 5: Tool Use](11-Chapter-05-Tool-Use.md) - [ ] [第六章:规划 | Chapter 6: Planning](12-Chapter-06-Planning.md) - [ ] [第七章:多智能体协作 | Chapter 7: Multi-Agent Collaboration](13-Chapter-07-Multi-Agent-Collaboration.md) ### 第二部分 | Part Two (61 页) - [ ] [第八章:记忆管理 | Chapter 8: Memory Management](14-Chapter-08-Memory-Management.md) - [ ] [第九章:学习与适应 | Chapter 9: Learning and Adaptation](15-Chapter-09-Learning-and-Adaptation.md) - [ ] [第十章:模型上下文协议 (MCP) | Chapter 10: Model Context Protocol (MCP)](16-Chapter-10-Model-Context-Protocol.md) - [ ] [第十一章:目标设定与监控 | Chapter 11: Goal Setting and Monitoring](17-Chapter-11-Goal-Setting-and-Monitoring.md) ### 第三部分 | Part Three (34 页) - [ ] [第十二章:异常处理与恢复 | Chapter 12: Exception Handling and Recovery](18-Chapter-12-Exception-Handling-and-Recovery.md) - [ ] [第十三章:人机协作 | Chapter 13: Human-in-the-Loop](19-Chapter-13-Human-in-the-Loop.md) - [ ] [第十四章:知识检索 (RAG) | Chapter 14: Knowledge Retrieval (RAG)](20-Chapter-14-Knowledge-Retrieval.md) ### 第四部分 | Part Four (114 页) - [ ] [第十五章:智能体间通信 (A2A) | Chapter 15: Inter-Agent Communication (A2A)](21-Chapter-15-Inter-Agent-Communication.md) - [ ] [第十六章:资源感知优化 | Chapter 16: Resource-Aware Optimization](22-Chapter-16-Resource-Aware-Optimization.md) - [ ] [第十七章:推理技术 | Chapter 17: Reasoning Techniques](23-Chapter-17-Reasoning-Techniques.md) - [ ] [第十八章:护栏/安全模式 | Chapter 18: Guardrails/Safety Patterns](24-Chapter-18-Guardrails-Safety-Patterns.md) - [ ] [第十九章:评估与监控 | Chapter 19: Evaluation and Monitoring](25-Chapter-19-Evaluation-and-Monitoring.md) - [ ] [第二十章:优先级排序 | Chapter 20: Prioritization](26-Chapter-20-Prioritization.md) - [ ] [第二十一章:探索与发现 | Chapter 21: Exploration and Discovery](27-Chapter-21-Exploration-and-Discovery.md) ### 附录 | Appendix (74 页) - [ ] [附录 A:高级提示技术 | Appendix A: Advanced Prompting Techniques](28-Appendix-A.md) - [ ] [附录 B:AI 智能体:从图形界面到现实世界环境 | Appendix B: AI Agentic: From GUI to Real world environment](29-Appendix-B.md) - [ ] [附录 C:智能体框架快速概览 | Appendix C: Quick overview of Agentic Frameworks](30-Appendix-C.md) - [ ] [附录 D:使用 AgentSpace 构建智能体(仅在线版本) | Appendix D: Building an Agent with AgentSpace (online only)](31-Appendix-D.md) - [ ] [附录 E:命令行中的 AI 智能体(在线版本) | Appendix E: AI Agents on the CLI (online)](32-Appendix-E.md) - [ ] [附录 F:深入了解:智能体推理引擎内部机制 | Appendix F: Under the Hood: An Inside Look at the Agents' Reasoning Engines](33-Appendix-F.md) - [ ] [附录 G:编程智能体 | Appendix G: Coding agents](34-Appendix-G.md) ### 结尾内容 | Back Matter - [ ] [结论 | Conclusion](35-Conclusion.md) - [ ] [术语表 | Glossary](36-Glossary.md) - [ ] [术语索引 | Index of Terms](37-Index.md) --- ## 🚀 21 个核心智能体设计模式 | 21 Core Agentic Design Patterns 本书介绍了 21 个核心智能体设计模式,涵盖从基础到高级的完整技术栈: ### 🔧 核心模式 | Core Patterns 1. **提示链 (Prompt Chaining)** - 分而治之的任务分解模式。它将复杂任务分解为一系列更小、更易管理的子问题,每个子问题通过专门设计的提示独立解决,前一步的输出传递给下一步作为输入,形成一个逻辑清晰的处理流水线。 2. **路由 (Routing)** - 智能决策与动态分发。它能根据环境状态、用户输入或执行结果等情境信息,从多个可选方案中选择合适的行动路径。路由决定将请求交给哪个功能模块、工具或子流程处理,让智能体不再只是沿着固定流程执行。 3. **并行化 (Parallelization)** - 并发执行与性能提升。它通过同时执行多个独立任务来提升智能体系统的效率和响应速度,将原本需要串行等待的操作转变为并发执行,是优化复杂智能体工作流性能的关键技术。 4. **反思 (Reflection)** - 自我评估和迭代改进。它让智能体具备自我评估和迭代改进的能力,通过引入反馈循环来不断优化输出质量。智能体不再只是执行任务并产出结果,而是会回过头来审视自己的工作,找出问题并生成更优版本。 5. **工具使用 (Tool Use)** - 外部工具与 API 集成 6. **规划 (Planning)** - 多步骤计划制定与执行 7. **多智能体 (Multi-Agent)** - 协同工作架构 ### 🎯 高级模式 | Advanced Patterns 8. **记忆管理 (Memory Management)** - 短期和长期记忆管理 9. **学习与适应 (Learning and Adaptation)** - 从经验中学习 10. **模型上下文协议 (MCP)** - 标准化交互协议 11. **目标设定与监控 (Goal Setting and Monitoring)** - 动态目标管理 ### 🔗 集成模式 | Integration Patterns 12. **异常处理与恢复 (Exception Handling and Recovery)** - 优雅错误处理 13. **人机协作 (Human-in-the-Loop)** - 人机协作决策 14. **知识检索 (RAG)** - 检索增强生成技术 ### 🏭 生产模式 | Production Patterns 15. **智能体间通信 (A2A)** - 智能体通信协议 16. **资源感知优化 (Resource-Aware Optimization)** - 资源优化管理 17. **推理技术 (Reasoning Techniques)** - 增强推理能力 18. **护栏/安全模式 (Guardrails/Safety Patterns)** - 安全保障机制 19. **评估与监控 (Evaluation and Monitoring)** - 性能评估体系 20. **优先级排序 (Prioritization)** - 任务优先级管理 21. **探索与发现 (Exploration and Discovery)** - 自主探索机制 --- ## 📖 如何使用本项目 | How to Use This Project ### 🎯 适合读者 | Target Audience - **AI 工程师** - 构建智能、可靠的 AI 系统 - **软件架构师** - 设计智能体组件系统 - **产品经理** - 了解智能体技术能力与局限 - **研究人员** - 学习最新智能体设计方法 - **学生** - 学习人工智能和智能体系统 ### 📚 阅读建议 | Reading Tips 1. **顺序阅读** - 建议按章节顺序,后续章节基于前面基础 2. **动手实践** - 每章都有代码示例,建议实际运行 3. **参考查阅** - 可作为设计模式参考手册使用 4. **社区参与** - 欢迎参与讨论和贡献 ### 💻 运行代码示例 | Running Code Examples 本项目在 `codes/` 目录中提供了各章节的代码示例。以下是运行代码的步骤: #### 1. 环境准备 | Environment Setup ```bash # 克隆仓库 git clone https://github.com/ginobefun/agentic-design-patterns-cn.git cd agentic-design-patterns-cn # 创建虚拟环境(推荐) python3 -m venv venv source venv/bin/activate # macOS/Linux # 或 Windows 系统: venv\Scripts\activate # 安装依赖(根据需要运行的代码示例安装相应依赖) pip install langchain langchain-community langchain-openai langgraph ``` #### 2. 配置 API 密钥 | Configure API Key 创建 `.env` 文件并配置你的 API 密钥: ```bash # 在项目根目录创建 .env 文件 touch .env ``` 在 `.env` 文件中添加以下内容: ```env # OpenAI API 密钥 OPENAI_API_KEY=your-openai-api-key-here # 或使用 OpenRouter(兼容 OpenAI API) OPENAI_API_KEY=your-openrouter-api-key-here OPENAI_API_BASE=https://openrouter.ai/api/v1 ``` #### 3. 运行代码 | Run Code ```bash # 确保虚拟环境已激活 source venv/bin/activate # 运行第一章示例:提示链 python codes/Chapter-01-Prompt-Chaining-Example.py # 运行其他章节的代码示例(待添加) # python codes/Chapter-XX-Example.py ``` #### 4. 在线运行 | Run Online 每个代码示例文件中都包含了 Google Colab 链接,可以直接在线运行,无需本地配置: - 📔 [第一章:提示链示例 - Colab](https://colab.research.google.com/drive/15XCzDOvBhIQaZ__xkvruf5sP9OznAbK9) #### 注意事项 | Notes - 🔑 **API 密钥安全**: 切勿将包含真实 API 密钥的 `.env` 文件提交到版本控制系统 - 💰 **API 费用**: 运行代码会产生 API 调用费用,请注意使用量 - 🌐 **网络连接**: 代码需要网络连接才能访问 LLM API 服务 - 🔄 **兼容性**: 代码示例支持 OpenAI API 和兼容 OpenAI API 的服务(如 OpenRouter) --- ## 🛠️ 翻译规范 | Translation Standards ### 📝 格式规范 - **高亮标记**: 中文内容使用 `文本` 黄色高亮 - **双语对照**: 英文段落后紧跟中文翻译 - **术语处理**: 重要术语保留英文,括号注明中文 - **空格规则**: 中英文、数字间添加空格 ### 🎯 质量标准 - **准确性**: 100% 忠实原文含义 - **流畅性**: 符合中文表达习惯 - **专业性**: 保持技术文档严谨性 - **一致性**: 术语翻译前后统一 详细翻译规范请参考 [rules.md](/rules/rules.md) 文档。 --- ## 🤝 贡献指南 | Contributing 欢迎社区贡献!你可以通过以下方式参与: ### 🔍 如何贡献 1. **错误报告** - 发现翻译错误或格式问题 2. **翻译改进** - 提供更优的翻译建议 3. **章节翻译** - 参与未完成章节的翻译 4. **校对审阅** - 帮助校对已翻译章节 ### 📋 贡献步骤 1. Fork 本仓库 2. 创建特性分支 (`git checkout -b feature/your-contribution`) 3. 提交更改 (`git commit -m 'Add: your contribution'`) 4. 推送到分支 (`git push origin feature/your-contribution`) 5. 创建 Pull Request --- ## 📄 版权信息 | Copyright ### 📖 原书版权 - **作者**: Antonio Gulli - **出版社**: Springer - **版权**: 原书版权归作者和出版社所有 - **公益性质**: 原书所有版税将捐赠给救助儿童会 (Save the Children) ### 🌏 翻译版权 - **翻译**: 本翻译项目基于 [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) 协议开源 - **目的**: 仅用于学习交流,促进中文 AI 社区发展 - **使用限制**: - ✅ 允许:自由复制、分发、展示和演绎作品(需署名译者) - ❌ 禁止:任何形式的商业使用 - 📧 商业合作:如需商业使用,请联系译者和原书版权方 --- ## ⭐ 支持项目 | Support the Project 如果这个项目对你有帮助,请考虑: - 🌟 给项目加 Star - 🍴 Fork 并参与贡献 - 📢 分享给更多需要的人 - 💝 支持原书作者的公益事业 --- 让我们一起构建更智能的未来! | *Let's build a smarter future together!*