Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove TaskAction functionality (#5959)

Robert Brennanf846b31eb852
diff --git a/frontend/src/types/action-type.tsx b/frontend/src/types/action-type.tsx
index a8d469b1cb..a217ba14a8 100644
--- a/frontend/src/types/action-type.tsx
+++ b/frontend/src/types/action-type.tsx
@@ -33,12 +33,6 @@ enum ActionType {
// Reject a request from user or another agent.
REJECT = "reject",
- // Adds a task to the plan.
- ADD_TASK = "add_task",
-
- // Updates a task in the plan.
- MODIFY_TASK = "modify_task",
-
// Changes the state of the agent, e.g. to paused or running
CHANGE_AGENT_STATE = "change_agent_state",
}
diff --git a/frontend/src/types/core/actions.ts b/frontend/src/types/core/actions.ts
index b88393c5a7..eb8aba6ada 100644
--- a/frontend/src/types/core/actions.ts
+++ b/frontend/src/types/core/actions.ts
@@ -78,27 +78,6 @@ export interface BrowseInteractiveAction
};
}
-export interface AddTaskAction extends OpenHandsActionEvent<"add_task"> {
- source: "agent";
- timeout: number;
- args: {
- parent: string;
- goal: string;
- subtasks: unknown[];
- thought: string;
- };
-}
-
-export interface ModifyTaskAction extends OpenHandsActionEvent<"modify_task"> {
- source: "agent";
- timeout: number;
- args: {
- task_id: string;
- state: string;
- thought: string;
- };
-}
-
export interface FileReadAction extends OpenHandsActionEvent<"read"> {
source: "agent";
args: {
@@ -144,6 +123,4 @@ export type OpenHandsAction =
| FileReadAction
| FileEditAction
| FileWriteAction
- | AddTaskAction
- | ModifyTaskAction
| RejectAction;
diff --git a/frontend/src/types/core/base.ts b/frontend/src/types/core/base.ts
index ce3fba3f08..9b03f4f4e4 100644
--- a/frontend/src/types/core/base.ts
+++ b/frontend/src/types/core/base.ts
@@ -10,8 +10,6 @@ export type OpenHandsEventType =
| "browse"
| "browse_interactive"
| "reject"
- | "add_task"
- | "modify_task"
| "finish"
| "error";
diff --git a/openhands/agenthub/__init__.py b/openhands/agenthub/__init__.py
index 85ae41d425..892c0d682d 100644
--- a/openhands/agenthub/__init__.py
+++ b/openhands/agenthub/__init__.py
@@ -12,12 +12,10 @@ from openhands.agenthub import ( # noqa: E402
codeact_agent,
delegator_agent,
dummy_agent,
- planner_agent,
)
__all__ = [
'codeact_agent',
- 'planner_agent',
'delegator_agent',
'dummy_agent',
'browsing_agent',
diff --git a/openhands/agenthub/dummy_agent/agent.py b/openhands/agenthub/dummy_agent/agent.py
index 272e6c935f..06abacab3e 100644
--- a/openhands/agenthub/dummy_agent/agent.py
+++ b/openhands/agenthub/dummy_agent/agent.py
@@ -1,4 +1,4 @@
-from typing import TypedDict, Union
+from typing import TypedDict
from openhands.controller.agent import Agent
from openhands.controller.state.state import State
@@ -6,7 +6,6 @@ from openhands.core.config import AgentConfig
from openhands.core.schema import AgentState
from openhands.events.action import (
Action,
- AddTaskAction,
AgentFinishAction,
AgentRejectAction,
BrowseInteractiveAction,
@@ -15,10 +14,10 @@ from openhands.events.action import (
FileReadAction,
FileWriteAction,
MessageAction,
- ModifyTaskAction,
)
from openhands.events.observation import (
AgentStateChangedObservation,
+ BrowserOutputObservation,
CmdOutputObservation,
FileReadObservation,
FileWriteObservation,
@@ -49,20 +48,6 @@ class DummyAgent(Agent):
def __init__(self, llm: LLM, config: AgentConfig):
super().__init__(llm, config)
self.steps: list[ActionObs] = [
- {
- 'action': AddTaskAction(
- parent='None', goal='check the current directory'
- ),
- 'observations': [],
- },
- {
- 'action': AddTaskAction(parent='0', goal='run ls'),
- 'observations': [],
- },
- {
- 'action': ModifyTaskAction(task_id='0', state='in_progress'),
- 'observations': [],
- },
{
'action': MessageAction('Time to get started!'),
'observations': [],
@@ -105,7 +90,12 @@ class DummyAgent(Agent):
{
'action': BrowseURLAction(url='https://google.com'),
'observations': [
- # BrowserOutputObservation('<html><body>Simulated Google page</body></html>',url='https://google.com',screenshot=''),
+ BrowserOutputObservation(
+ '<html><body>Simulated Google page</body></html>',
+ url='https://google.com',
+ screenshot='',
+ trigger_by_action='',
+ ),
],
},
{
@@ -113,7 +103,12 @@ class DummyAgent(Agent):
browser_actions='goto("https://google.com")'
),
'observations': [
- # BrowserOutputObservation('<html><body>Simulated Google page after interaction</body></html>',url='https://google.com',screenshot=''),
+ BrowserOutputObservation(
+ '<html><body>Simulated Google page after interaction</body></html>',
+ url='https://google.com',
+ screenshot='',
+ trigger_by_action='',
+ ),
],
},
{
@@ -135,30 +130,6 @@ class DummyAgent(Agent):
current_step = self.steps[state.iteration]
action = current_step['action']
- # If the action is AddTaskAction or ModifyTaskAction, update the parent ID or task_id
- if isinstance(action, AddTaskAction):
- if action.parent == 'None':
- action.parent = '' # Root task has no parent
- elif action.parent == '0':
- action.parent = state.root_task.id
- elif action.parent.startswith('0.'):
- action.parent = f'{state.root_task.id}{action.parent[1:]}'
- elif isinstance(action, ModifyTaskAction):
- if action.task_id == '0':
- action.task_id = state.root_task.id
- elif action.task_id.startswith('0.'):
- action.task_id = f'{state.root_task.id}{action.task_id[1:]}'
- # Ensure the task_id doesn't start with a dot
- if action.task_id.startswith('.'):
- action.task_id = action.task_id[1:]
- elif isinstance(action, (BrowseURLAction, BrowseInteractiveAction)):
- try:
- return self.simulate_browser_action(action)
- except (
- Exception
- ): # This could be a specific exception for browser unavailability
- return self.handle_browser_unavailable(action)
-
if state.iteration > 0:
prev_step = self.steps[state.iteration - 1]
@@ -190,22 +161,3 @@ class DummyAgent(Agent):
)
return action
-
- def simulate_browser_action(
- self, action: Union[BrowseURLAction, BrowseInteractiveAction]
- ) -> Action:
- # Instead of simulating, we'll reject the browser action
- return self.handle_browser_unavailable(action)
-
- def handle_browser_unavailable(
- self, action: Union[BrowseURLAction, BrowseInteractiveAction]
- ) -> Action:
- # Create a message action to inform that browsing is not available
- message = 'Browser actions are not available in the DummyAgent environment.'
- if isinstance(action, BrowseURLAction):
- message += f' Unable to browse URL: {action.url}'
- elif isinstance(action, BrowseInteractiveAction):
- message += (
- f' Unable to perform interactive browsing: {action.browser_actions}'
- )
- return MessageAction(content=message)
diff --git a/openhands/agenthub/planner_agent/__init__.py b/openhands/agenthub/planner_agent/__init__.py
deleted file mode 100644
index e8c030e84c..0000000000
--- a/openhands/agenthub/planner_agent/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from openhands.agenthub.planner_agent.agent import PlannerAgent
-from openhands.controller.agent import Agent
-
-Agent.register('PlannerAgent', PlannerAgent)
diff --git a/openhands/agenthub/planner_agent/agent.py b/openhands/agenthub/planner_agent/agent.py
deleted file mode 100644
index f5aef523d9..0000000000
--- a/openhands/agenthub/planner_agent/agent.py
+++ /dev/null
@@ -1,53 +0,0 @@
-from openhands.agenthub.planner_agent.prompt import get_prompt_and_images
-from openhands.agenthub.planner_agent.response_parser import PlannerResponseParser
-from openhands.controller.agent import Agent
-from openhands.controller.state.state import State
-from openhands.core.config import AgentConfig
-from openhands.core.message import ImageContent, Message, TextContent
-from openhands.events.action import Action, AgentFinishAction
-from openhands.llm.llm import LLM
-
-
-class PlannerAgent(Agent):
- VERSION = '1.0'
- """
- The planner agent utilizes a special prompting strategy to create long term plans for solving problems.
- The agent is given its previous action-observation pairs, current task, and hint based on last action taken at every step.
- """
- response_parser = PlannerResponseParser()
-
- def __init__(self, llm: LLM, config: AgentConfig):
- """Initialize the Planner 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, creates a plan prompt and sends to model for inference, returning the result as the next action.
-
- Parameters:
- - state (State): The current state given the previous actions and observations
-
- Returns:
- - AgentFinishAction: If the last state was 'completed', 'verified', or 'abandoned'
- - Action: The next action to take based on llm response
- """
- if state.root_task.state in [
- 'completed',
- 'verified',
- 'abandoned',
- ]:
- return AgentFinishAction()
-
- prompt, image_urls = get_prompt_and_images(
- state, self.llm.config.max_message_chars
- )
- content = [TextContent(text=prompt)]
- if self.llm.vision_is_active() and image_urls:
- content.append(ImageContent(image_urls=image_urls))
- message = Message(role='user', content=content)
- resp = self.llm.completion(messages=self.llm.format_messages_for_llm(message))
- return self.response_parser.parse(resp)
diff --git a/openhands/agenthub/planner_agent/prompt.py b/openhands/agenthub/planner_agent/prompt.py
deleted file mode 100644
index 7b73f43531..0000000000
--- a/openhands/agenthub/planner_agent/prompt.py
+++ /dev/null
@@ -1,191 +0,0 @@
-from openhands.controller.state.state import State
-from openhands.core.logger import openhands_logger as logger
-from openhands.core.schema import ActionType
-from openhands.core.utils import json
-from openhands.events.action import (
- Action,
- NullAction,
-)
-from openhands.events.serialization.action import action_from_dict
-from openhands.events.serialization.event import event_to_memory
-
-HISTORY_SIZE = 20
-
-prompt = """
-# Task
-You're a diligent software engineer AI. You can't see, draw, or interact with a
-browser, but you can read and write files, and you can run commands, and you can think.
-
-You've been given the following task:
-
-%(task)s
-
-## Plan
-As you complete this task, you're building a plan and keeping
-track of your progress. Here's a JSON representation of your plan:
-
-%(plan)s
-
-
-%(plan_status)s
-
-You're responsible for managing this plan and the status of tasks in
-it, by using the `add_task` and `modify_task` actions described below.
-
-If the History below contradicts the state of any of these tasks, you
-MUST modify the task using the `modify_task` action described below.
-
-Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
-a task that's already represented. Every task must be represented only once.
-
-Tasks that are sequential MUST be siblings. They must be added in order
-to their parent task.
-
-If you mark a task as 'completed', 'verified', or 'abandoned',
-all non-abandoned subtasks will be marked the same way.
-So before closing a task this way, you MUST not only be sure that it has
-been completed successfully--you must ALSO be sure that all its subtasks
-are ready to be marked the same way.
-
-If, and only if, ALL tasks have already been marked verified,
-you MUST respond with the `finish` action.
-
-## History
-Here is a recent history of actions you've taken in service of this plan,
-as well as observations you've made. This only includes the MOST RECENT
-ten actions--more happened before that.
-
-%(history)s
-
-
-Your most recent action is at the bottom of that history.
-
-## Action
-What is your next thought or action? Your response must be in JSON format.
-
-It must be an object, and it must contain two fields:
-* `action`, which is one of the actions below
-* `args`, which is a map of key-value pairs, specifying the arguments for that action
-
-* `read` - reads the content of a file. Arguments:
- * `path` - the path of the file to read
-* `write` - writes the content to a file. Arguments:
- * `path` - the path of the file to write
- * `content` - the content to write to the file
-* `run` - runs a command on the command line in a Linux shell. Arguments:
- * `command` - the command to run
-* `browse` - opens a web page. Arguments:
- * `url` - the URL to open
-* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
- * `content` - the message to record
- * `wait_for_response` - set to `true` to wait for the user to respond before proceeding
-* `add_task` - add a task to your plan. Arguments:
- * `parent` - the ID of the parent task (leave empty if it should go at the top level)
- * `goal` - the goal of the task
- * `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
-* `modify_task` - close a task. Arguments:
- * `task_id` - the ID of the task to close
- * `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
-* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
-
-You MUST take time to think in between read, write, run, and browse actions--do this with the `message` action.
-You should never act twice in a row without thinking. But if your last several
-actions are all `message` actions, you should consider taking a different action.
-
-What is your next thought or action? Again, you must reply with JSON, and only with JSON.
-
-%(hint)s
-"""
-
-
-def get_hint(latest_action_id: str) -> str:
- """Returns action type hint based on given action_id"""
- hints = {
- '': "You haven't taken any actions yet. Start by using `ls` to check out what files you're working with.",
- ActionType.RUN: 'You should think about the command you just ran, what output it gave, and how that affects your plan.',
- ActionType.READ: 'You should think about the file you just read, what you learned from it, and how that affects your plan.',
- ActionType.WRITE: 'You just changed a file. You should think about how it affects your plan.',
- ActionType.BROWSE: 'You should think about the page you just visited, and what you learned from it.',
- ActionType.MESSAGE: "Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.",
- ActionType.ADD_TASK: 'You should think about the next action to take.',
- ActionType.MODIFY_TASK: 'You should think about the next action to take.',
- ActionType.SUMMARIZE: '',
- ActionType.FINISH: '',
- }
- return hints.get(latest_action_id, '')
-
-
-def get_prompt_and_images(
- state: State, max_message_chars: int
-) -> tuple[str, list[str] | None]:
- """Gets the prompt for the planner agent.
-
- Formatted with the most recent action-observation pairs, current task, and hint based on last action
-
- Parameters:
- - state (State): The state of the current agent
-
- Returns:
- - str: The formatted string prompt with historical values
- """
- # the plan
- plan_str = json.dumps(state.root_task.to_dict(), indent=2)
-
- # the history
- history_dicts = []
- latest_action: Action = NullAction()
-
- # retrieve the latest HISTORY_SIZE events
- for event_count, event in enumerate(reversed(state.history)):
- if event_count >= HISTORY_SIZE:
- break
- if latest_action == NullAction() and isinstance(event, Action):
- latest_action = event
- history_dicts.append(event_to_memory(event, max_message_chars))
-
- # history_dicts is in reverse order, lets fix it
- history_dicts.reverse()
-
- # and get it as a JSON string
- history_str = json.dumps(history_dicts, indent=2)
-
- # the plan status
- current_task = state.root_task.get_current_task()
- if current_task is not None:
- plan_status = f"You're currently working on this task:\n{current_task.goal}."
- if len(current_task.subtasks) == 0:
- plan_status += "\nIf it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW."
- else:
- plan_status = "You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress."
-
- # the hint, based on the last action
- hint = get_hint(event_to_memory(latest_action, max_message_chars).get('action', ''))
- logger.debug('HINT:\n' + hint, extra={'msg_type': 'DETAIL'})
-
- # the last relevant user message (the task)
- message, image_urls = state.get_current_user_intent()
-
- # finally, fill in the prompt
- return prompt % {
- 'task': message,
- 'plan': plan_str,
- 'history': history_str,
- 'hint': hint,
- 'plan_status': plan_status,
- }, image_urls
-
-
-def parse_response(response: str) -> Action:
- """Parses the model output to find a valid action to take
- Parameters:
- - response (str): A response from the model that potentially contains an Action.
-
- Returns:
- - Action: A valid next action to perform from model output
- """
- action_dict = json.loads(response)
- if 'contents' in action_dict:
- # The LLM gets confused here. Might as well be robust
- action_dict['content'] = action_dict.pop('contents')
- action = action_from_dict(action_dict)
- return action
diff --git a/openhands/agenthub/planner_agent/response_parser.py b/openhands/agenthub/planner_agent/response_parser.py
deleted file mode 100644
index 12068cd5b7..0000000000
--- a/openhands/agenthub/planner_agent/response_parser.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from openhands.controller.action_parser import ResponseParser
-from openhands.core.utils import json
-from openhands.events.action import (
- Action,
-)
-from openhands.events.serialization.action import action_from_dict
-
-
-class PlannerResponseParser(ResponseParser):
- def __init__(self):
- super().__init__()
-
- def parse(self, response: str) -> Action:
- action_str = self.parse_response(response)
- return self.parse_action(action_str)
-
- def parse_response(self, response) -> str:
- # get the next action from the response
- return response['choices'][0]['message']['content']
-
- def parse_action(self, action_str: str) -> Action:
- """Parses a string to find an action within it
-
- Parameters:
- - response (str): The string to be parsed
-
- Returns:
- - Action: The action that was found in the response string
- """
- # attempt to load the JSON dict from the response
- action_dict = json.loads(action_str)
-
- if 'content' in action_dict:
- # The LLM gets confused here. Might as well be robust
- action_dict['contents'] = action_dict.pop('content')
-
- return action_from_dict(action_dict)
diff --git a/openhands/controller/agent_controller.py b/openhands/controller/agent_controller.py
index d4fd9178b3..2c0fd0f39f 100644
--- a/openhands/controller/agent_controller.py
+++ b/openhands/controller/agent_controller.py
@@ -26,7 +26,6 @@ from openhands.events import EventSource, EventStream, EventStreamSubscriber
from openhands.events.action import (
Action,
ActionConfirmationStatus,
- AddTaskAction,
AgentDelegateAction,
AgentFinishAction,
AgentRejectAction,
@@ -34,7 +33,6 @@ from openhands.events.action import (
CmdRunAction,
IPythonRunCellAction,
MessageAction,
- ModifyTaskAction,
NullAction,
)
from openhands.events.event import Event
@@ -213,6 +211,7 @@ class AgentController:
await self._react_to_exception(reported)
def should_step(self, event: Event) -> bool:
+ print('should step?', event)
if isinstance(event, Action):
if isinstance(event, MessageAction) and event.source == EventSource.USER:
return True
@@ -261,12 +260,7 @@ class AgentController:
await self._handle_message_action(action)
elif isinstance(action, AgentDelegateAction):
await self.start_delegate(action)
- elif isinstance(action, AddTaskAction):
- self.state.root_task.add_subtask(
- action.parent, action.goal, action.subtasks
- )
- elif isinstance(action, ModifyTaskAction):
- self.state.root_task.set_subtask_state(action.task_id, action.state)
+
elif isinstance(action, AgentFinishAction):
self.state.outputs = action.outputs
self.state.metrics.merge(self.state.local_metrics)
@@ -542,7 +536,9 @@ class AgentController:
self.update_state_before_step()
action: Action = NullAction()
try:
+ print('STEP AGENT')
action = self.agent.step(self.state)
+ print('GOT ACTION', action)
if action is None:
raise LLMNoActionError('No action was returned')
except (
diff --git a/openhands/core/schema/action.py b/openhands/core/schema/action.py
index dc4cfe542e..468de2e40a 100644
--- a/openhands/core/schema/action.py
+++ b/openhands/core/schema/action.py
@@ -62,10 +62,6 @@ class ActionTypeSchema(BaseModel):
SUMMARIZE: str = Field(default='summarize')
- ADD_TASK: str = Field(default='add_task')
-
- MODIFY_TASK: str = Field(default='modify_task')
-
PAUSE: str = Field(default='pause')
"""Pauses the task.
"""
diff --git a/openhands/events/action/__init__.py b/openhands/events/action/__init__.py
index 129cb30739..71da3099ae 100644
--- a/openhands/events/action/__init__.py
+++ b/openhands/events/action/__init__.py
@@ -15,7 +15,6 @@ from openhands.events.action.files import (
FileWriteAction,
)
from openhands.events.action.message import MessageAction
-from openhands.events.action.tasks import AddTaskAction, ModifyTaskAction
__all__ = [
'Action',
@@ -30,8 +29,6 @@ __all__ = [
'AgentRejectAction',
'AgentDelegateAction',
'AgentSummarizeAction',
- 'AddTaskAction',
- 'ModifyTaskAction',
'ChangeAgentStateAction',
'IPythonRunCellAction',
'MessageAction',
diff --git a/openhands/events/action/tasks.py b/openhands/events/action/tasks.py
deleted file mode 100644
index b1f1c215f7..0000000000
--- a/openhands/events/action/tasks.py
+++ /dev/null
@@ -1,29 +0,0 @@
-from dataclasses import dataclass, field
-
-from openhands.core.schema import ActionType
-from openhands.events.action.action import Action
-
-
-@dataclass
-class AddTaskAction(Action):
- parent: str
- goal: str
- subtasks: list = field(default_factory=list)
- thought: str = ''
- action: str = ActionType.ADD_TASK
-
- @property
- def message(self) -> str:
- return f'Added task: {self.goal}'
-
-
-@dataclass
-class ModifyTaskAction(Action):
- task_id: str
- state: str
- thought: str = ''
- action: str = ActionType.MODIFY_TASK
-
- @property
- def message(self) -> str:
- return f'Set task {self.task_id} to {self.state}'
diff --git a/openhands/events/serialization/action.py b/openhands/events/serialization/action.py
index f34b4b0ec0..208400fe92 100644
--- a/openhands/events/serialization/action.py
+++ b/openhands/events/serialization/action.py
@@ -18,7 +18,6 @@ from openhands.events.action.files import (
FileWriteAction,
)
from openhands.events.action.message import MessageAction
-from openhands.events.action.tasks import AddTaskAction, ModifyTaskAction
actions = (
NullAction,
@@ -32,8 +31,6 @@ actions = (
AgentFinishAction,
AgentRejectAction,
AgentDelegateAction,
- AddTaskAction,
- ModifyTaskAction,
ChangeAgentStateAction,
MessageAction,
)
diff --git a/openhands/server/mock/listen.py b/openhands/server/mock/listen.py
index 30aaef6858..d5e51585a9 100644
--- a/openhands/server/mock/listen.py
+++ b/openhands/server/mock/listen.py
@@ -49,7 +49,6 @@ def read_llm_models():
def read_llm_agents():
return [
'CodeActAgent',
- 'PlannerAgent',
]
diff --git a/openhands/storage/conversation/file_conversation_store.py b/openhands/storage/conversation/file_conversation_store.py
index b77555fcd5..0a08660394 100644
--- a/openhands/storage/conversation/file_conversation_store.py
+++ b/openhands/storage/conversation/file_conversation_store.py
@@ -4,9 +4,9 @@ import json
from dataclasses import dataclass
from openhands.core.config.app_config import AppConfig
+from openhands.server.data_models.conversation_metadata import ConversationMetadata
from openhands.storage import get_file_store
from openhands.storage.conversation.conversation_store import ConversationStore
-from openhands.server.data_models.conversation_metadata import ConversationMetadata
from openhands.storage.files import FileStore
from openhands.storage.locations import get_conversation_metadata_filename
from openhands.utils.async_utils import call_sync_from_async
diff --git a/tests/unit/test_action_serialization.py b/tests/unit/test_action_serialization.py
index 93c537937e..318dd612a2 100644
--- a/tests/unit/test_action_serialization.py
+++ b/tests/unit/test_action_serialization.py
@@ -1,6 +1,5 @@
from openhands.events.action import (
Action,
- AddTaskAction,
AgentFinishAction,
AgentRejectAction,
BrowseInteractiveAction,
@@ -9,7 +8,6 @@ from openhands.events.action import (
FileReadAction,
FileWriteAction,
MessageAction,
- ModifyTaskAction,
)
from openhands.events.action.action import ActionConfirmationStatus
from openhands.events.serialization import (
@@ -156,24 +154,3 @@ def test_file_write_action_serialization_deserialization():
},
}
serialization_deserialization(original_action_dict, FileWriteAction)
-
-
-def test_add_task_action_serialization_deserialization():
- original_action_dict = {
- 'action': 'add_task',
- 'args': {
- 'parent': 'Test parent',
- 'goal': 'Test goal',
- 'subtasks': [],
- 'thought': '',
- },
- }
- serialization_deserialization(original_action_dict, AddTaskAction)
-
-
-def test_modify_task_action_serialization_deserialization():
- original_action_dict = {
- 'action': 'modify_task',
- 'args': {'task_id': 1, 'state': 'Test state.', 'thought': ''},
- }
- serialization_deserialization(original_action_dict, ModifyTaskAction)
diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py
index d4ef11c4ce..8a72c2e326 100644
--- a/tests/unit/test_config.py
+++ b/tests/unit/test_config.py
@@ -71,7 +71,7 @@ def test_load_from_old_style_env(monkeypatch, default_config):
# Test loading configuration from old-style environment variables using monkeypatch
monkeypatch.setenv('LLM_API_KEY', 'test-api-key')
monkeypatch.setenv('AGENT_MEMORY_ENABLED', 'True')
- monkeypatch.setenv('DEFAULT_AGENT', 'PlannerAgent')
+ monkeypatch.setenv('DEFAULT_AGENT', 'BrowsingAgent')
monkeypatch.setenv('WORKSPACE_BASE', '/opt/files/workspace')
monkeypatch.setenv('SANDBOX_BASE_CONTAINER_IMAGE', 'custom_image')
@@ -79,7 +79,7 @@ def test_load_from_old_style_env(monkeypatch, default_config):
assert default_config.get_llm_config().api_key == 'test-api-key'
assert default_config.get_agent_config().memory_enabled is True
- assert default_config.default_agent == 'PlannerAgent'
+ assert default_config.default_agent == 'BrowsingAgent'
assert default_config.workspace_base == '/opt/files/workspace'
assert default_config.workspace_mount_path is None # before finalize_config
assert default_config.workspace_mount_path_in_sandbox is not None
@@ -333,8 +333,10 @@ def test_defaults_dict_after_updates(default_config):
updated_config.get_llm_config().api_key = 'updated-api-key'
updated_config.get_llm_config('llm').api_key = 'updated-api-key'
updated_config.get_llm_config_from_agent('agent').api_key = 'updated-api-key'
- updated_config.get_llm_config_from_agent('PlannerAgent').api_key = 'updated-api-key'
- updated_config.default_agent = 'PlannerAgent'
+ updated_config.get_llm_config_from_agent(
+ 'BrowsingAgent'
+ ).api_key = 'updated-api-key'
+ updated_config.default_agent = 'BrowsingAgent'
defaults_after_updates = updated_config.defaults_dict
assert defaults_after_updates['default_agent']['default'] == 'CodeActAgent'
@@ -547,7 +549,7 @@ max_budget_per_task = 4.0
[agent.CodeActAgent]
memory_enabled = true
-[agent.PlannerAgent]
+[agent.BrowsingAgent]
memory_max_threads = 10
"""
@@ -558,5 +560,5 @@ memory_max_threads = 10
codeact_config = default_config.get_agent_configs().get('CodeActAgent')
assert codeact_config.memory_enabled is True
- planner_config = default_config.get_agent_configs().get('PlannerAgent')
- assert planner_config.memory_max_threads == 10
+ browsing_config = default_config.get_agent_configs().get('BrowsingAgent')
+ assert browsing_config.memory_max_threads == 10
diff --git a/tests/unit/test_micro_agents.py b/tests/unit/test_micro_agents.py
index 5910582e4e..c7461bbda2 100644
--- a/tests/unit/test_micro_agents.py
+++ b/tests/unit/test_micro_agents.py
@@ -31,7 +31,7 @@ def event_stream(temp_dir):
def agent_configs():
return {
'CoderAgent': AgentConfig(memory_enabled=True),
- 'PlannerAgent': AgentConfig(memory_enabled=True),
+ 'BrowsingAgent': AgentConfig(memory_enabled=True),
}
diff --git a/tests/unit/test_response_parsing.py b/tests/unit/test_response_parsing.py
index 02710f4898..fd588d4c6e 100644
--- a/tests/unit/test_response_parsing.py
+++ b/tests/unit/test_response_parsing.py
@@ -1,9 +1,6 @@
import pytest
from openhands.agenthub.micro.agent import parse_response as parse_response_micro
-from openhands.agenthub.planner_agent.prompt import (
- parse_response as parse_response_planner,
-)
from openhands.core.exceptions import LLMResponseError
from openhands.core.utils.json import loads as custom_loads
from openhands.events.action import (
@@ -14,7 +11,7 @@ from openhands.events.action import (
@pytest.mark.parametrize(
'parse_response_module',
- [parse_response_micro, parse_response_planner],
+ [parse_response_micro],
)
def test_parse_single_complete_json(parse_response_module):
input_response = """
@@ -34,7 +31,7 @@ def test_parse_single_complete_json(parse_response_module):
@pytest.mark.parametrize(
'parse_response_module',
- [parse_response_micro, parse_response_planner],
+ [parse_response_micro],
)
def test_parse_json_with_surrounding_text(parse_response_module):
input_response = """
@@ -57,7 +54,7 @@ def test_parse_json_with_surrounding_text(parse_response_module):
@pytest.mark.parametrize(
'parse_response_module',
- [parse_response_micro, parse_response_planner],
+ [parse_response_micro],
)
def test_parse_first_of_multiple_jsons(parse_response_module):
input_response = """