routing
Routing
Anthropic canonical agent pattern. Classify first. Then send work to best path.
What It Is
Use a router to choose among specialists. Specialist can be prompt, model, tool chain, or agent. Goal: better fit per request.
When to Use
- Requests fall into clear categories
- Different categories need different prompts or tools
- Cheap classifier can pick path well
- Specialist path beats one general path
- Need cost or latency control by request type
When Not to Use
- Categories fuzzy or overlapping
- Generalist path already works
- Misroute cost high
- Too few examples to define routes
- Router logic harder than task
Core Flow
input
→ classify
→ pick route
→ specialist A
→ specialist B
→ specialist C
→ return result
Simple Implementation Outline
- Define route set.
- Write route criteria.
- Start with few routes.
- Make router output label + confidence.
- Add fallback path.
- Track route accuracy.
- Review misroutes. Refine criteria.
Good Routing Axes
- Intent type
- Task complexity
- Safety level
- Domain
- Required tool access
- Response format
Failure Modes
- Too many routes. Hard to maintain.
- Route definitions overlap.
- No fallback for low confidence.
- Router prompt leaks to specialists.
- Uneven traffic. Some routes rot.
- No eval set. Misroutes stay hidden.
Practical Checklist
- Clear route taxonomy
- Low-overlap route definitions
- Confidence or abstain option
- Fallback path exists
- Per-route prompts tested
- Misroute examples saved
- Metrics by route: quality, cost, latency
- Periodic route review
Decision Rule
Use routing when specialization wins and classification is cheap enough. If cases blur together, keep one path.
More from flpbalada/fb-skills
progressive-disclosure
Reduce complexity by revealing information progressively. Use when designing
7discuss-task
Clarify ambiguous tasks before action. Use when goal, scope, success criteria, constraints, or risks are unclear.
4cognitive-fluency-psychology
Apply cognitive fluency principles to improve clarity, trust, and conversion.
4react-useeffect-avoid
Guides when NOT to use useEffect and suggests better alternatives. Use when reviewing React code, troubleshooting performance, or considering useEffect for derived state or form resets.
4discuss-code
Critically discuss code issues with compact findings. Use when code needs review for logic, simplicity, structure, naming, or maintainability.
4learn
Extract reusable patterns from the current session. Use when errors, debugging techniques, workarounds, or project conventions should become skills.
3