| name | agentic-design-patterns-chinese |
| description | Chinese translation of Google's Agentic Design Patterns book - 21 core AI agent patterns with examples |
| triggers | ["agentic design patterns chinese translation","AI agent design patterns in Chinese","how to implement prompt chaining in Chinese","multi-agent collaboration patterns","RAG knowledge retrieval patterns","AI agent memory management strategies","tool use patterns for AI agents","human-in-the-loop AI patterns"] |
Agentic Design Patterns (Chinese Translation)
Skill by ara.so — AI Agent Skills collection.
This project is a comprehensive Chinese translation of Google's "Agentic Design Patterns" book, covering 21 core patterns for building intelligent AI agent systems, plus 7 appendices and additional resources.
Overview
The book systematically introduces AI agent design patterns from basic to advanced:
- Basic Patterns: Prompt Chaining, Routing, Parallelization
- Intermediate Patterns: Reflection, Tool Use, Planning
- Advanced Patterns: Multi-Agent Collaboration, Memory Management, RAG
- Practical Patterns: Safety/Guardrails, Evaluation & Monitoring
Project Structure
agentic-design-patterns/
├── chapters/ # Translated chapters (32 files)
│ ├── Chapter 1_ Prompt Chaining.md
│ ├── Chapter 2_ Routing.md
│ └── ...
├── original/ # Original English chapters
├── images/ # Image assets organized by chapter
├── glossary.md # Terminology reference
├── progress.md # Translation progress tracker
└── translation-guide.md # Translation standards
Accessing the Content
Online Reading
Visit the deployed GitHub Pages site:
https://adp.xindoo.xyz/
Local Setup
- Clone the repository:
git clone https://github.com/xindoo/agentic-design-patterns.git
cd agentic-design-patterns
- For local Jekyll server (GitHub Pages style):
bundle install
bundle exec jekyll serve
- For GitBook format:
npm install -g gitbook-cli
gitbook install
gitbook serve
Key Chapters & Patterns
Chapter 1: Prompt Chaining (提示链)
Breaking complex tasks into sequential prompts.
def analyze_document(doc):
summary_prompt = f"Summarize key points from: {doc}"
summary = llm.generate(summary_prompt)
sentiment_prompt = f"Analyze sentiment of: {summary}"
sentiment = llm.generate(sentiment_prompt)
rec_prompt = f"Based on sentiment {sentiment}, provide recommendations"
recommendations = llm.generate(rec_prompt)
return recommendations
Chapter 2: Routing (路由)
Directing requests to specialized agents or models.
def route_query(user_query):
classifier_prompt = f"Classify intent: {user_query}\nOptions: technical, billing, general"
intent = llm.generate(classifier_prompt)
routes = {
"technical": technical_agent,
"billing": billing_agent,
"general": general_agent
}
agent = routes.get(intent, general_agent)
return agent.process(user_query)
Chapter 5: Tool Use (工具使用)
Enabling agents to call external tools and APIs.
tools = [
{
"name": "search_database",
"description": "Search product database",
"parameters": {"query": "string"}
},
{
"name": "calculate_price",
"description": "Calculate final price with discount",
"parameters": {"base_price": "float", "discount": "float"}
}
]
def agent_with_tools(user_request):
response = llm.generate(
prompt=user_request,
tools=tools,
tool_choice="auto"
)
if response.tool_calls:
for tool_call in response.tool_calls:
result = execute_tool(tool_call.name, tool_call.arguments)
final_response = llm.generate(
context=[user_request, result]
)
return final_response
Chapter 7: Multi-Agent Collaboration (多智能体协作)
Coordinating multiple specialized agents.
class ResearchTeam:
def __init__(self):
self.researcher = Agent("researcher", "Find information")
self.analyst = Agent("analyst", "Analyze data")
self.writer = Agent("writer", "Write report")
def collaborate(self, topic):
research_data = self.researcher.execute(
f"Research topic: {topic}"
)
analysis = self.analyst.execute(
f"Analyze research: {research_data}"
)
report = self.writer.execute(
f"Write report based on: {analysis}"
)
return report
Chapter 14: Knowledge Retrieval (RAG)
Retrieval-Augmented Generation pattern.
from sentence_transformers import SentenceTransformer
import faiss
class RAGAgent:
def __init__(self, knowledge_base):
self.encoder = SentenceTransformer('all-MiniLM-L6-v2')
self.index = self._build_index(knowledge_base)
self.documents = knowledge_base
def _build_index(self, documents):
embeddings = self.encoder.encode([doc['text'] for doc in documents])
index = faiss.IndexFlatL2(embeddings.shape[1])
index.add(embeddings)
return index
def query(self, question, top_k=3):
query_embedding = self.encoder.encode([question])
distances, indices = self.index.search(query_embedding, top_k)
context = "\n".join([
self.documents[i]['text'] for i in indices[0]
])
prompt = f"Context: {context}\n\nQuestion: {question}\nAnswer:"
answer = llm.generate(prompt)
return answer
Chapter 8: Memory Management (记忆管理)
Managing short-term and long-term memory.
class ConversationMemory:
def __init__(self, max_history=10):
self.short_term = []
self.long_term = {}
self.max_history = max_history
def add_message(self, role, content):
self.short_term.append({"role": role, "content": content})
if len(self.short_term) > self.max_history:
summary = self._summarize_old_messages()
self._store_to_long_term(summary)
self.short_term = self.short_term[-self.max_history:]
def get_context(self):
context = []
if self.long_term:
context.append({"role": "system", "content": f"Previous context: {self.long_term}"})
context.extend(self.short_term)
return context
Translation Workflow
Contributing to Translation
- Check translation progress:
cat progress.md
- Select a chapter (currently all are in review status):
# Update progress.md
- [x] 已翻译 Chapter X
- [ ] 已审核 Chapter X
- Follow translation guide:
cat translation-guide.md
cat glossary.md
- Key translation principles:
- Use glossary for consistent terminology
- Keep code examples in original language
- Preserve markdown structure
- Maintain image paths relative to
images/
Terminology Reference
Common AI agent terms (from glossary.md):
| English | 中文 | Notes |
|---------|------|-------|
| Agent | 智能体 / 代理 | Context-dependent |
| Prompt Chaining | 提示链 | |
| Routing | 路由 | |
| Tool Use | 工具使用 | |
| RAG | 检索增强生成 | Keep acronym |
| Multi-Agent | 多智能体 | |
| Guardrails | 护栏 / 安全防护 | |
| Human-in-the-Loop | 人机协同 | |
Configuration
GitHub Pages (_config.yml)
title: Agentic Design Patterns 中文翻译
description: AI Agent 系统设计模式完整中文指南
url: "https://adp.xindoo.xyz"
baseurl: ""
markdown: kramdown
theme: jekyll-theme-minimal
GitBook (SUMMARY.md)
The book structure is defined in SUMMARY.md:
# Summary
* [简介](README.md)
* [核心章节](chapters/README.md)
* [第1章:提示链](chapters/Chapter 1_ Prompt Chaining.md)
* [第2章:路由](chapters/Chapter 2_ Routing.md)
...
* [附录](chapters/README.md)
* [附录A:高级提示技术](chapters/Appendix A_ Advanced Prompting Techniques.md)
...
Common Patterns & Use Cases
Pattern 1: Sequential Processing (Prompt Chaining)
Use when: Breaking down complex analysis into steps
result = chain_step1() → chain_step2() → chain_step3()
Pattern 2: Parallel Processing (Parallelization)
Use when: Independent subtasks can run concurrently
results = await asyncio.gather(
task1(), task2(), task3()
)
Pattern 3: Self-Improvement (Reflection)
Use when: Output quality needs iterative refinement
output = generate()
critique = reflect(output)
improved = regenerate(critique)
Pattern 4: Dynamic Routing
Use when: Different inputs need different handling
handler = router.select(input_type)
result = handler.process(input)
Troubleshooting
Issue: Images not displaying
Problem: Image paths broken after translation
 # Wrong
Solution: Use correct relative paths
 # Correct from chapters/
Issue: Inconsistent terminology
Problem: Same English term translated differently
Agent → 智能体 (Chapter 1)
Agent → 代理 (Chapter 2) # Inconsistent
Solution: Always check glossary.md first
grep "Agent" glossary.md
Issue: Jekyll build fails
Problem:
Liquid Exception: Invalid Date
Solution: Check frontmatter dates in markdown files
---
updated_at: "2026-05-17"
---
Issue: Missing dependencies
Problem: bundle exec jekyll serve fails
Solution: Install dependencies
gem install bundler
bundle install
npm install -g gitbook-cli
gitbook install
Advanced Usage
Searching the Content
Use grep for term searches:
grep -r "RAG" chapters/
grep -r "def.*agent" chapters/
grep -r "多智能体" chapters/
Extracting Code Examples
sed -n '/```python/,/```/p' chapters/Chapter\ 5_\ Tool\ Use.md
Generating PDF/EPUB
gitbook pdf ./ ./agentic-patterns-zh.pdf
gitbook epub ./ ./agentic-patterns-zh.epub
Resources
Contributing
git clone https://github.com/YOUR_USERNAME/agentic-design-patterns.git
git checkout -b review/chapter-1-improvements
git add chapters/Chapter\ 1_\ Prompt\ Chaining.md
git commit -m "Review and improve Chapter 1 translation"
git push origin review/chapter-1-improvements
Follow CONTRIBUTING.md for detailed guidelines.