Naar de inhoud

Router-Worker-pijplijn

De Router-Worker-architectuur scheidt Intentieclassificatie, Taakplanningen Agent Uitvoering in drie afzonderlijke lagen. Zo zijn eenvoudige vragen snel beantwoord en blijft volledige autonomie beschikbaar voor complexe taken.

Laag 1 — Intentieclassificatie (IntentRouter)

Het oorspronkelijke bericht van de gebruiker wordt ingedeeld in een Type intentie en Planvorm met één LLM-aanroep die precies twee tokens teruggeeft (bijv. EDIT TASKLIST).

Intentietypes

IntentiePlanvormBeschrijving
ConversationalDirectAnswerBegroetingen, small talk, statusvragen
CodeAnalysisDirectAnswerAlleen-lezen verkennen, zoeken, uitleggen
CodeEditTaskListSchrijfbewerkingen, fixes, refactoring
ShellTaskTaskListBuild-, test- en compileercommando's
KnowledgeQueryDirectAnswerArchitectuur, patronen, "wat doet X"
FileStatsCountDirectAnswerAantal regels, groottes, controleren of iets bestaat
UnknownTaskListOnduidelijk, terugvallen op de volledige agentlus

Planvormen

  • DirectAnswer - Eén LLM-antwoord, geen tools nodig
  • TaskList - Gestructureerd plan met uitvoerbare stappen

Laag 2 — Taakplanning (TaskPlanner)

Voor TaskList -intenties stelt de planner een concreet TaskPlan op met stappen die uitvoer kunnen doorgeven via $stepN verwijzingen.

Opbouw van TaskPlan

{
  "steps": [
    {
      "id": "step1",
      "agent": "code_editor",
      "action": "read_file",
      "parameters": { "path": "Program.cs" },
      "description": "Read the main entry point"
    },
    {
      "id": "step2",
      "agent": "code_editor",
      "action": "apply_diff",
      "parameters": { "path": "Program.cs", "diff": "Listing: C:\Users\x11\Desktop\newsite\GravityLandingPage\Views\Docs (top-level only)
Found 12 items:
- [FILE] Views\Docs\Architecture.cshtml
- [FILE] Views\Docs\Article.cshtml
- [FILE] Views\Docs\Article.cshtml.bak.639273610948482039
- [FILE] Views\Docs\Article.cshtml.bak.639273615833682148
- [FILE] Views\Docs\Index.cshtml
- [FILE] Views\Docs\Index.cshtml.bak.639273610427101065
- [FILE] Views\Docs\Index.cshtml.bak.639273615329883474
- [FILE] Views\Docs\Index.cshtml.bak.639273616218142076
- [FILE] Views\Docs\Installation.cshtml
- [FILE] Views\Docs\Licensing.cshtml
- [FILE] Views\Docs\Licensing.cshtml.bak.639273620177728074
- [FILE] Views\Docs\Licensing.cshtml.bak.639273620356689749
.output" },
      "description": "Apply the fix"
    }
  ]
}

Key features:

  • Output chaining - Steps can reference $stepN.output from previous steps
  • Agent assignment - Each step targets a specific agent
  • Parameter validation - JSON schema validation before execution
  • Parallel execution hints - Independent steps can run concurrently

Laag 3 — Uitvoering door agents (Orchestrator)

De Orchestrator beheert een pool van agents (maximaal 5 gelijktijdige AppEngine instances). Each engine runs a reasoning loop up to MaxSteps iterations.

Execution Loop

  1. Observe - Receive task step or user message
  2. Reason - Call LLM with system prompt, history, and available tools
  3. Act - LLM outputs tool call → ReasoningRouter → doel IAgent
  4. Observe Result - Agent returns AgentResult (success/output/error)
  5. Loop - Feed observation back to LLM until task complete or max steps

AppEngine

Each AppEngine instance maintains its own conversation history, token budget, and compression state. The Orchestrator assigns steps to available engines.

Snelle route voor eenvoudige vragen

Simple read/list commands are detected by regex and executed directly without LLM involvement:

  • "show me Program.cs" → code_editor.read_file
  • "list files in src" → code_editor.list_directory
  • "search for TODO" → code_editor.search_in_files

This reduces latency from ~2-5s to ~50-200ms for common exploration tasks.