Agent Design Patterns: Routing Pattern for Intelligent Decision-Making and Dynamic Distribution

🚀 Agentic Design Patterns Chinese Translation Project
Just as Design Patterns was once regarded as the bible of software engineering, the free, open-access Agentic Design Patterns — authored by a senior Google engineering director — delivers the first systematic set of design principles for the fast-growing AI agent field.
Author: Antonio Gulli
Foreword: Saurabh Tiwary (VP, Google Cloud AI)
Endorsement: Marco Argenti (CIO, Goldman Sachs)
This book distills 21 core agent design patterns, covering techniques from prompt chaining, tool usage, to multi-agent collaboration and self-correction.
Translation Plan
Over the next month, I will translate the book using:
- AI initial translation
- AI cross-review
- Meticulous human refinement
Open-source repository: github.com/ginobefun/agentic-design-patterns-cn
---
📖 Translated Chapters
---
🔍 Routing Pattern Overview
The Routing Pattern adds conditional branching to agent systems, enabling dynamic decision-making instead of following a fixed, linear process.
Why It Matters
- Prompt chaining is linear — it cannot adapt to changing contexts or varied inputs.
- Routing adds flexibility: the system can analyze input, detect intent, and select the most appropriate sub-agent or tool.
---
4 Routing Implementation Methods
- LLM-Based Routing
- Use prompts to guide an LLM to classify input and signal the next execution target.
- Best for deep semantic understanding.
- Embedding-Based Routing
- Convert queries to vector embeddings, compare with route-specific embeddings, and select the highest similarity path.
- Best for semantic matching.
- Rule-Based Routing
- Apply predefined if–else/switch rules for quick, deterministic decisions.
- Best for speed, less flexible for complex contexts.
- ML Model-Based Routing
- Train a discriminative model on labeled data; encode decision logic in weights.
- Does not require real-time LLM calls.
---
3 Key Application Scenarios
- Human–Computer Interaction
- A virtual assistant detects intent and routes tasks:
- Simple → Q&A agent
- Account → DB query tool
- Complex → Human support
- Data Processing Pipelines
- Classify and send data to appropriate workflows (e.g. sales lead handling, urgent escalation).
- Multi-Agent Collaboration
- A scheduler assigns tasks to the most suitable agent based on current objectives.
---
Practical Frameworks
- LangChain/LangGraph: Conditional routing via `RunnableBranch`.
- Google ADK: Define sub-agents; LLM-driven delegation without explicit routing code.
---
When to Use the Routing Pattern
- Multiple workflows/tools need selection based on input.
- Requests must be classified and dispatched.
- Multi-functional systems require differentiated handling.
- Systems need to adapt dynamically to context changes.
---
💡 Code Examples
1. LangChain Implementation
Demonstrates building a coordinator agent that routes user requests to specialized handlers:
pip install langchain langgraph google-cloud-aiplatform langchain-google-genai google-adk deprecated pydantic
Full LangChain Python Example ↗
Sample flow:
- LLM classifies request (`booker`, `info`, `unclear`)
- `RunnableBranch` delegates to matching handler.
---
2. Google ADK Implementation
Uses ADK’s Auto-Flow style, routing to sub-agents based on coordinator instructions.
Install:
pip install google-genai google-adk
---
📌 Key Takeaways
The Problem:
Linear workflows are too rigid for varied real-world inputs.
The Solution:
Add conditional logic to select the optimal path via:
- LLM classification
- Rule-based systems
- Embedding similarity
Benefits:
- Flexible and context-aware execution
- Essential for customer support, data processing, multi-agent workflows
---

Illustration: LLM acting as a router node.
---
🔗 References
---
🌐 Beyond Routing: Content Publishing
Open-source ecosystems like AiToEarn integrate:
- AI content generation
- Cross-platform publishing
- Monetization
- Analytics & model ranking (AI模型排名)
Platforms supported: Douyin, Kwai, WeChat, Bilibili, Xiaohongshu, Facebook, Instagram, LinkedIn, Threads, YouTube, Pinterest, X/Twitter.
Coupling intelligent routing with AiToEarn lets you:
- Route tasks to the right agents/tools
- Publish results across global platforms
- Maximize reach & monetization
---
Conclusion:
The Routing Pattern transforms static agents into adaptive decision-makers. Mastering routing is essential for building robust and intelligent AI systems in any domain.
---
Do you want me to add a visual decision-flow chart for the Routing Pattern to make the explanation more intuitive? That could clarify its use even more.