Router Agent (LEGACY)
DEPRECATED - This document describes the legacy multi-agent routing system that was removed in December 2024.
DEPRECATION NOTICE: This document describes the legacy RouterAgent which was removed in December 2024 as part of the loop-based agent refactoring. The system now uses a single
CloudflareChatAgentwith tool iterations instead of multi-agent routing. See architecture.md for current implementation.
Legacy Documentation
TL;DR (Historical): Analyzed queries with patterns (instant) then LLM. Routed to Simple/Orchestrator/HITL/etc. Saved 75% tokens via smart dispatch.
Table of Contents
Hybrid Flow
RouterAgent uses two-phase classification:
Key: Patterns hit 80% cases instantly. LLM fallback for semantics.
Decision Tree
| Priority | Condition | Route |
|---|---|---|
| 1 | type: tool_confirmation | hitl-agent ✅ |
| 2 | requiresHumanApproval: true | hitl-agent |
| 3 | category: duyet | duyet-info-agent |
| 4 | research + medium/high | lead-researcher-agent |
| 5 | complexity: high | orchestrator-agent |
| 6 | simple + low | simple-agent |
| 7 | code/research/github | orchestrator-agent (->workers) |
Code Snippet
packages/cloudflare-agent/src/routing/classifier.ts
Quiz: Router vs Simple?
A: Router classifies/routs; Simple answers directly ✅
Glossary: Hybrid Classify ->
Related: Orchestrator -> | Architecture ->
Try: @duyetbot classify "fix this code" -> See routing live!