Skip to content

Agent calls python_execute without required arguments for simple queries #1345

@ilonae

Description

@ilonae

Bug Description

Bug: Agent Calls python_execute Without Required Arguments for Simple Queries

Bug Description

When asking simple factual questions (e.g., "where is Boston"), the Manus agent attempts to call the python_execute tool without providing the required code parameter, resulting in a TypeError.

Steps to Reproduce

  1. Run: python main.py
  2. Input: where is Boston
  3. Observe: TypeError about missing required argument 'code'

Expected Behavior

For simple questions that don't require tool use, the agent should answer directly without invoking tools. If tools are invoked, all required parameters should be provided.

Actual Behavior

TypeError: PythonExecute.execute() missing 1 required positional argument: 'code'

Root Cause

  1. System prompt is too broad, encouraging unnecessary tool use
  2. LLM (Claude via OpenRouter) doesn't validate required parameters before generating tool calls
  3. Missing error handling for incomplete tool calls

Environment

  • System: macOS Monterey
  • Python: 3.12
  • OpenManus: main v0.3.0-148-g52a13f2

Suggested Solutions

  1. Improve system prompt to guide against unnecessary tool use
  2. Add validation for required tool parameters before execution
  3. Provide clearer error messages when tools are called incorrectly

Bug solved method

Unresolved - Investigation details provided below

Environment information

  • System version: macOS
  • Python version: 3.12
  • OpenManus version or branch:
  • Installation method (e.g., pip install -r requirements.txt or pip install -e .): pip install -r requirements.txt

Extra information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions