Add task tracking tool for long-horizon tasks (#10166)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
This commit is contained in:
Ryan H. Tran
2025-08-16 20:05:59 +07:00
committed by GitHub
parent 0ec6ed20cb
commit fe486ad1f1
32 changed files with 1017 additions and 39 deletions

View File

@@ -35,11 +35,13 @@ from openhands.events.action import (
FileReadAction,
IPythonRunCellAction,
MessageAction,
TaskTrackingAction,
)
from openhands.events.action.agent import CondensationRequestAction
from openhands.events.action.mcp import MCPAction
from openhands.events.event import FileEditSource, FileReadSource
from openhands.events.tool import ToolCallMetadata
from openhands.llm.tool_names import TASK_TRACKER_TOOL_NAME
def combine_thought(action: Action, thought: str) -> Action:
@@ -220,6 +222,24 @@ def response_to_actions(
)
action = BrowseInteractiveAction(browser_actions=arguments['code'])
# ================================================
# TaskTrackingAction
# ================================================
elif tool_call.function.name == TASK_TRACKER_TOOL_NAME:
if 'command' not in arguments:
raise FunctionCallValidationError(
f'Missing required argument "command" in tool call {tool_call.function.name}'
)
if arguments['command'] == 'plan' and 'task_list' not in arguments:
raise FunctionCallValidationError(
f'Missing required argument "task_list" for "plan" command in tool call {tool_call.function.name}'
)
action = TaskTrackingAction(
command=arguments['command'],
task_list=arguments.get('task_list', []),
)
# ================================================
# MCPAction (MCP)
# ================================================