Duyetbot Agent
Concepts

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 CloudflareChatAgent with 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:

                       User Query
                           |
                           v
                   Pattern Match?
                  (10-50ms check)
                    |         |
                 YES|         |NO
                    |         v
                    |    LLM Classify
                    |    (200-500ms)
                    |         |
                    |         v
                    |    Classify result?
                    |  (type/category/complexity)
                    |         |
       +----+----+----+----+----+------+----------+
       |    |    |    |    |    |      |          |
    hi/help tool_ duyet research  high code/ research
       |    confm |        |(med) complex github
       |    |    |        | ity |
       v    v    v        v     v     v          v
    Simple HITL Duyet LeadResearch Orchestr Orchestr
    Agent Agent Agent    Worker    Agent    Agent

Key: Patterns hit 80% cases instantly. LLM fallback for semantics.

Decision Tree

PriorityConditionRoute
1type: tool_confirmationhitl-agent ✅
2requiresHumanApproval: truehitl-agent
3category: duyetduyet-info-agent
4research + medium/highlead-researcher-agent
5complexity: highorchestrator-agent
6simple + lowsimple-agent
7code/research/githuborchestrator-agent (->workers)

Code Snippet

packages/cloudflare-agent/src/routing/classifier.ts

export function determineRouteTarget(classification: QueryClassification): RouteTarget {
  if (classification.type === 'tool_confirmation') return 'hitl-agent';
  // ... hybrid logic
}

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!

On this page