π OpenHands: AI-Driven Development
Remove DelegatorAgent (fix #7280)
Engel Nystdd09d46ccb7d
diff --git a/evaluation/integration_tests/run_infer.py b/evaluation/integration_tests/run_infer.pyindex d215b0599b..f900bb294b 100644--- a/evaluation/integration_tests/run_infer.py+++ b/evaluation/integration_tests/run_infer.py@@ -34,7 +34,6 @@ from openhands.utils.async_utils import call_async_from_syncFAKE_RESPONSES = {'CodeActAgent': fake_user_response,- 'DelegatorAgent': fake_user_response,'VisualBrowsingAgent': fake_user_response,}diff --git a/openhands/agenthub/__init__.py b/openhands/agenthub/__init__.pyindex 6e91fc952e..b625e18f50 100644--- a/openhands/agenthub/__init__.py+++ b/openhands/agenthub/__init__.py@@ -6,7 +6,6 @@ load_dotenv()from openhands.agenthub import ( # noqa: E402browsing_agent,codeact_agent,- delegator_agent,dummy_agent,visualbrowsing_agent,)@@ -15,7 +14,6 @@ from openhands.controller.agent import Agent # noqa: E402__all__ = ['Agent','codeact_agent',- 'delegator_agent','dummy_agent','browsing_agent','visualbrowsing_agent',diff --git a/openhands/agenthub/delegator_agent/__init__.py b/openhands/agenthub/delegator_agent/__init__.pydeleted file mode 100644index 68e20efa30..0000000000--- a/openhands/agenthub/delegator_agent/__init__.py+++ /dev/null@@ -1,4 +0,0 @@-from openhands.agenthub.delegator_agent.agent import DelegatorAgent-from openhands.controller.agent import Agent--Agent.register('DelegatorAgent', DelegatorAgent)diff --git a/openhands/agenthub/delegator_agent/agent.py b/openhands/agenthub/delegator_agent/agent.pydeleted file mode 100644index 7cb987c8c3..0000000000--- a/openhands/agenthub/delegator_agent/agent.py+++ /dev/null@@ -1,87 +0,0 @@-from openhands.controller.agent import Agent-from openhands.controller.state.state import State-from openhands.core.config import AgentConfig-from openhands.events.action import Action, AgentDelegateAction, AgentFinishAction-from openhands.events.observation import AgentDelegateObservation, Observation-from openhands.llm.llm import LLM---class DelegatorAgent(Agent):- VERSION = '1.0'- """- The Delegator Agent is responsible for delegating tasks to other agents based on the current task.- """-- current_delegate: str = ''-- def __init__(self, llm: LLM, config: AgentConfig):- """Initialize the Delegator Agent with an LLM-- Parameters:- - llm (LLM): The llm to be used by this agent- """- super().__init__(llm, config)-- def step(self, state: State) -> Action:- """Checks to see if current step is completed, returns AgentFinishAction if True.- Otherwise, delegates the task to the next agent in the pipeline.-- Parameters:- - state (State): The current state given the previous actions and observations-- Returns:- - AgentFinishAction: If the last state was 'completed', 'verified', or 'abandoned'- - AgentDelegateAction: The next agent to delegate the task to- """- if self.current_delegate == '':- self.current_delegate = 'study'- task, _ = state.get_current_user_intent()- return AgentDelegateAction(- agent='StudyRepoForTaskAgent', inputs={'task': task}- )-- # last observation in history should be from the delegate- last_observation = None- for event in reversed(state.history):- if isinstance(event, Observation):- last_observation = event- break-- if not isinstance(last_observation, AgentDelegateObservation):- raise Exception('Last observation is not an AgentDelegateObservation')-- goal, _ = state.get_current_user_intent()- if self.current_delegate == 'study':- self.current_delegate = 'coder'- return AgentDelegateAction(- agent='CoderAgent',- inputs={- 'task': goal,- 'summary': last_observation.outputs['summary'],- },- )- elif self.current_delegate == 'coder':- self.current_delegate = 'verifier'- return AgentDelegateAction(- agent='VerifierAgent',- inputs={- 'task': goal,- },- )- elif self.current_delegate == 'verifier':- if (- 'completed' in last_observation.outputs- and last_observation.outputs['completed']- ):- return AgentFinishAction()- else:- self.current_delegate = 'coder'- return AgentDelegateAction(- agent='CoderAgent',- inputs={- 'task': goal,- 'summary': last_observation.outputs['summary'],- },- )- else:- raise Exception('Invalid delegate state')