Google ADKgoogle-adk 2.8 · Python 3.10+
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
28 small wins to finish your pathNext lesson

What ADK reads off your function

Hand that function to ADK and it writes a description of it. That description is the only thing a model ever sees, so it is worth looking at once.

Example
from google.adk.tools import FunctionTool


def lookup_order(order_id: str) -> str:
    """Look up the status of an order by its id."""
    return f"Order {order_id} shipped on 3 March."


declaration = FunctionTool(func=lookup_order)._get_declaration()

print("name:       ", declaration.name)
print("description:", declaration.description)

Your function name became the name. Your docstring became the description. Nothing was invented, and nothing else was added.

And the arguments

Example
schema = declaration.parameters_json_schema

print("parameters:", list(schema["properties"]))
print("types:     ", {k: v["type"] for k, v in schema["properties"].items()})
print("required:  ", schema["required"])

The type hint became the type. The parameter is required because it has no default value, and giving it one would make it optional.

Running this also prints a warning saying the JSON schema feature is experimental. It is ADK saying the shape of that one field may change, and it does not affect anything you are about to build.

The whole point

A model never sees your code. It sees this: a name, a sentence, and a list of arguments. When an agent calls the wrong tool, this is the thing to print first, because it is exactly what the model was working from.

The docstring is the interface
This is why lesson 2 made a fuss about the docstring. It is not documentation here, it is the interface.
Try it yourself
  • Change the docstring and print the declaration again.
  • Add a second parameter with a default value and see it leave the required list.

Slow is fine. Stopping is the only problem.