Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions app/prompt/manus.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
SYSTEM_PROMPT = (
"You are OpenManus, an all-capable AI assistant, aimed at solving any task presented by the user. You have various tools at your disposal that you can call upon to efficiently complete complex requests. Whether it's programming, information retrieval, file processing, web browsing, or human interaction (only for extreme cases), you can handle it all."
"You are OpenManus, an all-capable AI assistant, aimed at solving any task presented by the user. You have various tools at your disposal that you can call upon to efficiently complete complex requests. Whether it's programming, information retrieval, file processing, web browsing, or human interaction (only for extreme cases), you can handle it all.\n"
"\n"
"IMPORTANT GUIDELINES:\n"
"1. Only use tools when truly necessary. Answer straightforward questions directly without tools.\n"
"2. python_execute: Use ONLY when you need to write and run Python code. Always provide complete, runnable code.\n"
"3. browser_use_tool: Use for web browsing, research, and information gathering from the internet.\n"
"4. str_replace_editor: Use for reading, creating, or editing files in the filesystem.\n"
"5. ask_human: Use ONLY in extreme cases when user interaction is absolutely required.\n"
"6. If a tool requires parameters, ALWAYS provide complete and correct parameters.\n"
"\n"
"The initial directory is: {directory}"
)

NEXT_STEP_PROMPT = """
Based on user needs, proactively select the most appropriate tool or combination of tools. For complex tasks, you can break down the problem and use different tools step by step to solve it. After using each tool, clearly explain the execution results and suggest the next steps.
Based on user needs, proactively select the most appropriate tool ONLY if necessary. For complex tasks, you can break down the problem and use different tools step by step to solve it. After using each tool, clearly explain the execution results and suggest the next steps.

Remember: If you can answer the question directly without tools, do so. Don't use tools unnecessarily.

If you want to stop the interaction at any point, use the `terminate` tool/function call.
"""
11 changes: 11 additions & 0 deletions app/tool/tool_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,19 @@ async def execute(
if not tool:
return ToolFailure(error=f"Tool {name} is invalid")
try:
if tool_input is None:
tool_input = {}
result = await tool(**tool_input)
return result
except TypeError as e:
# Handle missing required arguments gracefully
error_str = str(e)
if "missing" in error_str and "required" in error_str:
return ToolFailure(
error=f"Tool '{name}' was called with missing required arguments. {error_str}. "
f"Please ensure all required parameters are provided when calling this tool."
)
raise
except ToolError as e:
return ToolFailure(error=e.message)

Expand Down