adk-python
adk-python copied to clipboard
Agent calling tool without required arguments
Describe the bug The agent is calling roll_die with no args. I am getting this error:
user: Can you roll a die?
Traceback (most recent call last):
...
TypeError: roll_die() missing 1 required positional argument: 'sides'
Here is my code:
def roll_die(sides: int):
return random.randint(1, 6)
root_agent = Agent(
name="die_agent",
model="gemini-2.0-flash",
description=(
"Agent to roll a die."
),
instruction=(
"You are a helpful agent that can roll a die for a user"
),
tools=[roll_die],
)
Expected behavior I know the tool should have a docstring, and adding the docstring may fix the problem. But I think the agent should know the function signature and that it can't call the tool without providing the required arguments.
Desktop (please complete the following information):
- OS: macos
- Python version(python -V): 3.13
- ADK version(pip show google-adk): 0.3.0
Fixed in https://github.com/google/adk-python/commit/f872577f683cf7644d4d7fac31c687b023953b3c
Please reopen if you have any follow up questions.