-
Notifications
You must be signed in to change notification settings - Fork 4
Feature: Supervisor Workflow + DI #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Supervisor Workflow + DI #88
Conversation
…pervisor-workflow
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>
There was a problem hiding this 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
EventPlanningCoordinatorwithSupervisorOrchestratorExecutorwhere routing decisions are made by an LLM supervisor agent via structured output - Introduces dependency injection using
dependency-injectorlibrary to manage client and global tools lifecycle - Refactors all agent factory functions to use
@injectdecorator for automatic dependency injection - Updates
SpecialistOutputmodel toSupervisorDecisionmodel 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 |
thegovind
left a comment
There was a problem hiding this 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
|
@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. |
There was a problem hiding this 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!
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:
budget_analyst,catering_coordinator,logistics_manager,venue_specialist) to use dependency injection viadependency-injector. Agent constructors now receive their dependencies automatically, removing the need to pass clients or tools manually. [1] [2] [3] [4]clientandglobal_toolsvia DI, and include the MCP sequential-thinking tool only if present inglobal_tools. This enables explicit dependency injection and easier testing/mocking. [1] [2] [3] [4]Removal of Event Coordinator Agent Export:
event_coordinatoragent is no longer exported fromagents/__init__.pyand its module has been removed, reflecting a shift to specialist agents only. Theexport_agents()function now returns only specialist agents and documents DI requirements. [1] [2] [3]Async Context Management for MCP Tool:
Dependency Updates:
dependency-injectorandlangchain-coretopyproject.tomldependencies 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.