Skip to content

feat(agents): add multi-agent supervisor primitives - #343

Open
tikhandesanket wants to merge 2 commits into
codeforstartups:developmentfrom
tikhandesanket:Sort_Multi_agent#289
Open

tikhandesanket wants to merge 2 commits into
codeforstartups:developmentfrom
tikhandesanket:Sort_Multi_agent#289

Conversation

@tikhandesanket

Copy link
Copy Markdown
Collaborator

Description

This PR implements the multi-agent supervisor pattern proposed in #289.

The supervisor acts as a central orchestrator that receives a user request, determines which specialist agent should handle it, and routes the request accordingly.

The implementation focuses on keeping the agents decoupled, with the supervisor responsible for coordination rather than embedding specialist-specific logic into individual agents.

Related issue

Fixes #289

Changes

  • Add a supervisor agent responsible for routing requests.
  • Support routing to multiple specialist agents.
  • Preserve conversation/state information during agent handoffs.
  • Keep specialist agents independently defined and reusable.
  • Add tests covering supervisor routing and agent handoffs.

Testing

  • Tests pass locally
  • Ruff checks pass
  • Documentation updated, if applicable

Checklist

  • My changes are focused and relevant to this pull request.
  • I have added or updated tests where appropriate.
  • I have reviewed my changes for unrelated modifications.
  • I have updated documentation where necessary.

@Kaap10 Kaap10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @tikhandesanket. While the goal of introducing multi-agent primitives from #289 is great, the current implementation consists of placeholder abstractions that don't yet fulfill the requirements of the issue:

  1. Supervisor does not route requests:
    In src/dynavec/agents/supervisor.py, Supervisor.run() runs every agent sequentially in a list comprehension ([agent.run(goal, state=state) for agent in self.agents]). A supervisor needs routing logic (e.g., using an LLM or router prompt) to determine which named specialist agent to delegate to based on the user's request, rather than executing all agents for every query.

  2. Handoff is an identity function:
    In src/dynavec/agents/handoff.py, Handoff.__call__ is currently return state. A handoff mechanism should actively transfer execution control and conversation/context between agents (e.g., as a callable tool or graph transition).

  3. ReActAgent does not use state and breaks async parity:
    In src/dynavec/agents/react.py, state: AgentState | None = None was added to run(), but it is never read, modified, or incorporated into messages/prompts. Additionally, arun() was not updated to accept state, breaking parity between sync and async execution.

  4. Missing scope from #289:
    The issue requires routing to named agents, control + context handoffs, and sub-agents runnable as nodes/sub-graphs.

Please revisit the architecture so that the supervisor performs actual task routing and handoffs transfer execution control. We can't merge placeholder primitives into the public API.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-agent: supervisor, handoffs & sub-agents

2 participants