Skip to main content
Okay — our help desk agent can talk, but it can’t do anything yet. In this lesson we’ll turn that conversational assistant into an actionable agent by registering tools the model can call.
A presentation slide titled "Tool Fundamentals in ADK" with the word "Demo" in large cyan text on a dark curved shape at the right. A small "© Copyright KodeKloud" appears in the bottom-left.
What is a tool?
  • Conceptually, a tool is a function or method: it accepts structured inputs, performs an operation, and returns structured outputs.
  • ADK exposes tool signatures to the LLM so the model can decide whether to call them. This is similar to LLM function-calling, but ADK adds richer typing and integration with your Python runtime.
Core idea in brief
  • Tools use typed/structured inputs and return structured outputs (commonly small JSON-like dicts).
  • ADK registers tool definitions and exposes them to the model; the LLM inspects signatures and decides whether to call a tool.
  • When a tool is invoked, ADK runs the Python function and passes the structured result back to the model; the model formats a human-friendly response for the user.
Types of tools
ADK can auto-wrap simple Python functions and register them as tools when included in an agent’s tools list. The LLM will see the function signature and may call it when relevant.
Example — build a simple helpdesk agent with a custom lookup tool
  • Goal: create an agent that can check whether a user exists in a directory. The custom function returns a small, typed dictionary the model can consume and present to the user.
  • In production, replace the fake directory with your organization’s user directory, handle authentication, and return well-typed responses.
How the LLM + ADK tool workflow works (step-by-step)
  1. User: “My email is broken; can you check my account? My address is alice@example.com.”
  2. The LLM reads the agent instruction and inspects available tool signatures.
  3. If useful, the model decides to call a tool (e.g., lookup_user).
  4. ADK executes the Python function: lookup_user("alice@example.com").
  5. ADK returns the structured result to the LLM.
  6. The LLM uses the tool output to generate a concise, human-facing reply.
Example (simulated) logging for a model call
Best practices for tool design and production readiness
  • Type and validate outputs: return small, well-structured dicts (status codes, named fields) so the model can unambiguously interpret results.
  • Handle errors explicitly: include clear status or error fields instead of free-form text.
  • Implement authentication and access control for tools that touch sensitive systems.
  • Add rate limiting and retry policies where appropriate.
  • Log tool calls and model decisions for auditing and debugging.
  • In development, use IDE auto-complete to discover built-in ADK tools — but treat IDE hints as convenience, not authoritative runtime state.
Common troubleshooting tips
  • If the model seems unaware of a tool, confirm the function was registered in the agent’s tools list and that ADK had access to the function at agent creation time.
  • Inspect structured tool outputs in logs to confirm the function returned the expected schema.
  • Use concise, deterministic tool outputs to reduce hallucination risk (the model is less likely to invent results when the tool provides explicit status fields).
Links and references Next steps
  • Open agent.py and implement a real lookup_user that calls your directory service or database.
  • Add additional tools (service checks, ticket lookups, password reset helpers) and iteratively test how the agent chooses and composes tool calls end-to-end.

Watch Video