Skip to content
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

[Feat] Exploring AgentDelegation through Supervisor Agent #4449

Draft
wants to merge 59 commits into
base: main
Choose a base branch
from

Conversation

AlexCuadron
Copy link
Contributor

End-user friendly description of the problem this fixes or functionality that this introduces
Exploring if agents can achieve better outputs if they have supervision. This is a draft PR.

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Give a summary of what the PR does, explaining any non-trivial design decisions
We propose a hierarchical agent framework that introduces a "supervisor" agent responsible for overseeing the big picture of a given goal. This supervisor agent holds the overall objective and devises a plan comprising sequential steps to achieve it. Subordinate agents are assigned independent tasks, allowing them to focus on specific subtasks without being burdened by the overall complexity. The supervisor coordinates these agents, ensuring that their outputs align with the overarching goal.

Supervisor Agent

  • Big Picture Oversight: Maintains the overall goal and the plan to achieve it.
  • Task Delegation: Assigns independent tasks to subordinate agents.
  • Output Coordination: Determines which outputs are needed from agents to progress towards the goal.
  • Communication Hub: Acts as an intermediary for agents to pass outputs to the next agent.
  • Guidance and Intervention:
    • Provides clarifications and additional information when agents request it.
    • Monitors task progress and can interrupt agents if they take too long.
    • Offers guidance based on its comprehensive understanding and outputs from other agents.

Subordinate Agents

  • Focused Task Execution: Concentrate solely on their assigned tasks.
  • Independent Operation: Perform tasks without needing to manage the overall plan.
  • Output Submission: Provide results to the supervisor for coordination.
  • Feedback Loop: Can request clarifications or more information from the supervisor.

Communication Flow

Agents communicate with the supervisor for:

  • Task assignments.
  • Submitting outputs.
  • Requesting guidance or clarification.

The supervisor ensures outputs are appropriately routed to subsequent agents or integrated into the overall plan.

Asymmetric Model Scenarios

  • Advanced Supervisors:

    • Utilize sophisticated models (e.g., o1-preview, Claude 3.5 Sonnet) as supervisors.
    • Advantages: Better at solving complex issues and managing tasks.
    • Consideration: Higher operational costs due to model complexity.
  • Economical Subordinate Agents:

    • Employ smaller, cost-effective models (e.g., DeepSeek, o1-mini) for subtasks.
    • Advantages: Reduced costs while maintaining efficiency in task execution.

Link of any specific issues this addresses

@ngduyanhece
Copy link

Overall Feedback:

The introduction of the Supervisor Agent is a promising enhancement to the agent framework, providing a structured approach to task delegation and coordination. The design effectively outlines the roles of both the supervisor and subordinate agents, ensuring clarity in their interactions and responsibilities. The implementation appears to be well thought out, with a focus on maintaining the overall goal while allowing subordinate agents to operate independently.

Score: 90/100

Code Suggestions:

  1. File: openhands/agenthub/supervisor_agent/prompt.py
    • Language: Python
    • Suggestion: In the adjust_milestones function, consider adding validation to ensure that the subtask dictionary contains the expected keys (task, suggested_approach, important_details) before attempting to access them. This can prevent potential KeyError exceptions if the dictionary is malformed.
    • Relevant Line: + milestone_task = subtask['task']

The Supervisor Agent framework is a well-structured addition, enhancing task delegation and coordination. Here are some suggestions:

  1. In adjust_milestones, add validation to ensure the subtask dictionary contains the expected keys to prevent potential KeyError exceptions.

@mamoodi
Copy link
Collaborator

mamoodi commented Dec 16, 2024

@AlexCuadron anything that needs to be done here to move it forward? Are you looking for reviews? Or is this still in progress? There's been a month of no activity so just want to understand the status.

@AlexCuadron
Copy link
Contributor Author

AlexCuadron commented Dec 16, 2024

@AlexCuadron anything that needs to be done here to move it forward? Are you looking for reviews? Or is this still in progress? There's been a month of no activity so just want to understand the status.

It is still in progress, I work closely with @xingyaoww on this one, I have many changes on local. I need to make the PR more "ready" then I can update the PR.

@enyst
Copy link
Collaborator

enyst commented Jan 1, 2025

This is an exciting work! 🎉

@@ -12,8 +12,6 @@
codeact_agent,
delegator_agent,
dummy_agent,
planner_agent,
supervisor_agent,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Merge issue? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch & so fast! I'm impressed hahaha

Copy link
Contributor Author

@AlexCuadron AlexCuadron Jan 8, 2025

Choose a reason for hiding this comment

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

Actually, the system should be done by ~15th Jan. Ill ping you directly when that happens if you are interested ^^

Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely, thank you!

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.

6 participants