Skip to content

Separate routing logic from dispatch execution #59

Description

@eshulman2

Description

Decouple the routing logic (which agent should handle which action item) from the dispatch execution (actually sending requests to agents). This separation improves maintainability, testing, and enables advanced routing strategies.

Current Architecture

The AgentDispatchOrchestrator currently combines routing and dispatch:

# Current: Routing and dispatch are tightly coupled
@step
async def dispatch_to_agents(self, ctx: Context, ev: StartEvent):
    for action_item in ev.action_items:
        # Routing logic embedded here
        if "jira" in action_item.category.lower():
            agent = agents["jira-agent"]
        elif "meeting" in action_item.description.lower():
            agent = agents["google-agent"]

        # Dispatch logic also here
        result = await self._execute_agent(agent, action_item)

Proposed Architecture

  1. Separate Router Module
  2. Enhanced LLM Capability Based Routing
  3. Separated Dispatcher
  4. Updated Orchestrator
  5. User Can See Routing Decision In Review Phase

Benefits

1. Testability

  • Test routing logic independently
  • Test dispatch logic independently
  • Mock components easily

2. Observability

  • Track routing decisions separately
  • Monitor routing confidence scores
  • Analyze routing accuracy

3. Advanced Features

  • Fallback routing to alternative agents
  • Multi-agent routing (for complex tasks)

Acceptance Criteria

  • Separate AgentRouter module created
  • Separate AgentDispatcher module created
  • Orchestrator uses separated components
  • Routing decisions logged and traceable
  • Unit tests for router
  • Unit tests for dispatcher
  • Integration tests for full flow
  • Documentation of routing strategies

Priority: 🟡 Medium
Effort: 8-10 hours
Difficulty: Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions