Skip to content

Conversation

@lavaman131
Copy link
Collaborator

Short Description

Implements new supervisor workflow that simplifies event planning system. For details on the design refer to the spec here.

Modifies agent creation to use dependency injection and local tool creation in agent factory functions.

Long Description

This pull request refactors agent creation to use dependency injection and async context management, improving lifecycle handling, testability, and code clarity. The changes remove global state and manual cleanup for the MCP sequential-thinking tool, update agent constructors to use injected dependencies, and modernize the project’s architecture for better composability and maintainability.

Dependency Injection & Agent Construction:

  • Refactored all specialist agents (budget_analyst, catering_coordinator, logistics_manager, venue_specialist) to use dependency injection via dependency-injector. Agent constructors now receive their dependencies automatically, removing the need to pass clients or tools manually. [1] [2] [3] [4]
  • Agent creation functions now accept client and global_tools via DI, and include the MCP sequential-thinking tool only if present in global_tools. This enables explicit dependency injection and easier testing/mocking. [1] [2] [3] [4]

Removal of Event Coordinator Agent Export:

  • The event_coordinator agent is no longer exported from agents/__init__.py and its module has been removed, reflecting a shift to specialist agents only. The export_agents() function now returns only specialist agents and documents DI requirements. [1] [2] [3]

Async Context Management for MCP Tool:

  • The MCP sequential-thinking tool lifecycle is now managed via an async context manager, eliminating global state and fragile manual cleanup. The design document describing the refactor and migration has been removed, indicating completion of this work.

Dependency Updates:

  • Added dependency-injector and langchain-core to pyproject.toml dependencies to support the new DI pattern and future extensibility.

These changes together modernize agent construction, remove legacy patterns, and lay the foundation for robust, scalable multi-agent workflows.

Alex Lavaee and others added 20 commits November 1, 2025 17:03
Task 10 cleanup:
- Remove event_coordinator import/usage from agents/__init__.py
- Delete tests/test_workflow_executors.py (obsolete coordinator tests)
- Delete tests/test_workflow_no_summarization.py (obsolete coordinator tests)
- Update budget_analyst.py to remove SpecialistOutput reference in comment
- Update supervisor.py to remove EventPlanningCoordinator reference in docstring

All remaining tests pass (45 passed, 5 skipped).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused global_tools parameters from agent factory functions
- Update imports and dependencies throughout codebase
- Fix test imports and assertions to match new supervisor pattern
- Clean up docstrings to remove obsolete parameter documentation

This completes the removal of the old coordinator pattern in favor
of the new supervisor-based workflow architecture.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings November 2, 2025 02:13
@lavaman131 lavaman131 requested a review from a team as a code owner November 2, 2025 02:13
@lavaman131 lavaman131 changed the title Alexlavaee/feature/supervisor workflow Feature: Supervisor Workflow + DI Nov 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a major architectural refactoring from a coordinator-centric pattern to a supervisor pattern with dependency injection:

  • Replaces EventPlanningCoordinator with SupervisorOrchestratorExecutor where routing decisions are made by an LLM supervisor agent via structured output
  • Introduces dependency injection using dependency-injector library to manage client and global tools lifecycle
  • Refactors all agent factory functions to use @inject decorator for automatic dependency injection
  • Updates SpecialistOutput model to SupervisorDecision model for routing decisions
  • Removes deleted files including old coordinator code and obsolete test files

Reviewed Changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/spec_to_agents/workflow/supervisor.py New supervisor orchestrator and workflow builder for dynamic routing
src/spec_to_agents/container.py New DI container managing client and global tools
src/spec_to_agents/models/messages.py Renamed SpecialistOutput to SupervisorDecision
src/spec_to_agents/agents/*.py Refactored agent factories to use @inject for DI
src/spec_to_agents/workflow/core.py Updated to use supervisor pattern with DI
src/spec_to_agents/console.py Updated to initialize DI container
tests/*.py Updated tests for new architecture with type hints
pyproject.toml Added dependency-injector and langchain-core dependencies

Copy link
Collaborator

@thegovind thegovind left a comment

Choose a reason for hiding this comment

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

I think we should remove langchain dependency here - @lavaman131 @copilot

Copy link
Contributor

Copilot AI commented Nov 2, 2025

@thegovind I've opened a new pull request, #89, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Collaborator

@thegovind thegovind left a comment

Choose a reason for hiding this comment

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

Great work, simplifying core with participants instead of add edge methods everywhere, and DI - decoupling agents from client and tools. Feels much simpler than earlier with executors. Thank you!

@markwallace-microsoft markwallace-microsoft merged commit 7cab3bf into main Nov 3, 2025
4 checks passed
markwallace-microsoft added a commit that referenced this pull request Nov 5, 2025
…rvisor-workflow"

This reverts commit 7cab3bf, reversing
changes made to 605ad30.
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.

4 participants