Skip to content

feat: Agent-to-agent handoff and delegation #218

@ecschoye

Description

@ecschoye

Summary

Enable multi-agent workflows where a primary agent can delegate subtasks to specialized agents with different models or configurations.

Motivation

Complex tasks benefit from specialization:

  • Use a fast/cheap model for simple subtasks (summarization, classification)
  • Route reasoning-heavy tasks to a stronger model
  • Parallel execution of independent subtasks
  • Separation of concerns (research agent vs coding agent)

Requirements

  • delegate tool: spawn a sub-agent with a specific prompt and model
  • Model routing: delegate to different provider/model combinations
  • Context passing: share relevant context with sub-agents
  • Result aggregation: collect and synthesize sub-agent outputs
  • Recursion limits (prevent infinite delegation loops)
  • Cost tracking per sub-agent

Configuration

[agents.researcher]
provider = "gemini"
model = "gemini-2.0-flash"
system_prompt = "You are a research assistant..."

[agents.coder]
provider = "openrouter"
model = "anthropic/claude-sonnet-4-20250514"
system_prompt = "You are a coding assistant..."

Implementation Notes

  • Build on existing RouterProvider hint system
  • Sub-agents share the same tool registry
  • Consider async execution with result futures
  • Leverage ReliableProvider for sub-agent calls

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions