念
Routing
Routing — classify the input, then dispatch it to a specialized downstream pipeline
Routing achieves separation of concerns: different input types are handled by different dedicated prompts or models, so optimizing for one type does not hurt the others. Classification can be done by an LLM or a traditional classifier. Fits when tasks have clear categories and classification is reliable.
Typical use cases
Customer-support routing
General question→FAQ pipeline
Refund request→Refund prompt + permissions
Tech support→Tech knowledge base + ticketing
Model-selection routing
Simple query→Small model (Haiku) — low cost
Complex reasoning→Large model (Sonnet/Opus) — high capability
Placement in agentic workflows vs Prompt Chaining Chaining is linear serial; routing is a fork — same entry, different exit paths Classifier choice LLM classification (flexible, handles fuzzy edges) vs traditional classifier (fast, deterministic)
→ Agentic Systems · Prompt Chaining · Orchestrator-WorkersAnthropic (2024)
Routing(路由)
定义
对输入进行分类,然后导向专门化的后续处理流程。实现关注点分离——不同类型的输入由不同的专用 prompt 处理,避免为一类输入优化时损害其他类型的表现。
适用场景
任务有明确的类别划分,且分类本身可以准确完成(LLM 或传统分类器均可)。
典型用例:
- 客服系统:一般问题、退款请求、技术支持导向不同处理流程
- 模型选择:简单问题用小模型(Haiku),复杂问题用大模型(Sonnet)
在 agentic 系统中的位置
属于 agentic systems 中的 workflow 模式。是 prompt chaining 的分支变体——从线性变为分叉。
References
sources/anthropic_official/building-effective-agents.md