diff --git a/app/agent/manus.py b/app/agent/manus.py index 940472e..db68cca 100644 --- a/app/agent/manus.py +++ b/app/agent/manus.py @@ -26,11 +26,12 @@ class Manus(ToolCallAgent): system_prompt: str = SYSTEM_PROMPT next_step_prompt: str = NEXT_STEP_PROMPT + max_observe: int = 2000 + max_steps: int = 20 + # Add general-purpose tools to the tool collection available_tools: ToolCollection = Field( default_factory=lambda: ToolCollection( PythonExecute(), GoogleSearch(), BrowserUseTool(), FileSaver(), Terminate() ) ) - - max_steps: int = 20 diff --git a/app/agent/toolcall.py b/app/agent/toolcall.py index b3b6439..8d6930f 100644 --- a/app/agent/toolcall.py +++ b/app/agent/toolcall.py @@ -1,5 +1,5 @@ import json -from typing import Any, List, Literal +from typing import Any, List, Literal, Optional, Union from pydantic import Field @@ -31,6 +31,7 @@ class ToolCallAgent(ReActAgent): tool_calls: List[ToolCall] = Field(default_factory=list) max_steps: int = 30 + max_observe: Optional[Union[int, bool]] = None async def think(self) -> bool: """Process current state and decide next actions using tools""" @@ -110,6 +111,10 @@ class ToolCallAgent(ReActAgent): results = [] for command in self.tool_calls: result = await self.execute_tool(command) + + if self.max_observe: + result = result[: self.max_observe] + logger.info( f"🎯 Tool '{command.function.name}' completed its mission! Result: {result}" ) diff --git a/app/tool/terminate.py b/app/tool/terminate.py index 2c8e783..8c2d82c 100644 --- a/app/tool/terminate.py +++ b/app/tool/terminate.py @@ -1,7 +1,8 @@ from app.tool.base import BaseTool -_TERMINATE_DESCRIPTION = """Terminate the interaction when the request is met OR if the assistant cannot proceed further with the task.""" +_TERMINATE_DESCRIPTION = """Terminate the interaction when the request is met OR if the assistant cannot proceed further with the task. +When you have finished all the tasks, call this tool to end the work.""" class Terminate(BaseTool):