Skip to content

ADK doesn't enforce argument types in function calling #4612

@cuihaoleo

Description

@cuihaoleo

🔴 Required Information

Describe the Bug:

ADK doesn't seem to check and enforce argument types in function calls. I'm very surprised.

Steps to Reproduce:

Code:

from google.adk.agents.llm_agent import Agent

def set_num(num: int) -> dict:
    print("DEBUG:", type(num), num)
    return {"status": "success"}

root_agent = Agent(
    model='gemini-3-flash-preview',
    name='root_agent',
    instruction="the user is debugging something. do whatever they instruct",
    tools=[set_num],
)

Test run:

Running agent root_agent, type exit to exit.
[user]: set num to 3.14159. I know it only accept int. but I'd like to see the error.
DEBUG: <class 'int'> 3
DEBUG: <class 'float'> 3.14159
[root_agent]: It appears that the system accepted the value `3.14159` without returning an error, despite the parameter being defined as an integer. This suggests that the value may have been automatically rounded or truncated by the underlying implementation.
[user]: set num to "foobar"
DEBUG: <class 'str'> foobar
[root_agent]: The tool unexpectedly returned `success` even when passed the string `"foobar"`. It seems the parameter type enforcement for `num` is not currently working as expected in the underlying system.
[user]: set num to null.       
DEBUG: <class 'NoneType'> None
[root_agent]: The system also returned `success` when `num` was set to `null`. It appears that the tool is accepting various types without validation errors.

Expected Behavior:

ADK enforces that invalid arguments don't go through, as an average LLM also believes:

Image

Observed Behavior:

Invalid arguments that have different types than the function signature requirements are accepted.

Environment Details:

  • ADK Library Version (pip show google-adk): 1.25.1
  • Desktop OS: Linux
  • Python Version (python -V): 3.13.12

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-3-flash-preview

Metadata

Metadata

Assignees

No one assigned

    Labels

    core[Component] This issue is related to the core interface and implementation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions