You can trace Google Agent Development Kit (ADK) agent and tool calls in Weave using OpenTelemetry (OTEL). ADK is a flexible and modular framework for developing and deploying AI agents. Although optimized for Gemini and the Google ecosystem, ADK is model independent and deployment independent. It provides tools for creating, deploying, and orchestrating agentic architectures that range from simple tasks to complex workflows.
This guide is for developers building agents with ADK who want end-to-end observability of agent reasoning, tool calls, and multi-agent workflows. It explains how to trace ADK agent and tool calls using OTEL, and visualize those traces in Weave. You’ll learn how to install the required dependencies, configure an OTEL tracer to send data to Weave, and instrument your ADK agents and tools. With traces in Weave, you can debug agent behavior, monitor performance, and inspect how data flows through your agents and tools.
Prerequisites
-
Install the required dependencies:
-
Set your Google API key as an environment variable:
-
Configure OTEL tracing in Weave.
To send traces from ADK to Weave, configure OTEL with a TracerProvider and an OTLPSpanExporter. Set the exporter to the correct endpoint and HTTP headers for authentication and project identification.
Store sensitive environment variables like your API key and project information in an environment file (for example, .env), and load them using os.environ. This keeps your credentials secure and out of your codebase.
Required configuration
- Endpoint:
https://trace.wandb.ai/otel/v1/traces. If you’re using a dedicated Weave instance, the URL follows this pattern instead: [YOUR-WEAVE-HOST]/traces/otel/v1/traces.
- Headers:
Authorization: Basic auth using your W&B API key.
project_id: Your W&B entity/project name (for example, myteam/myproject).
Send OTEL traces from ADK to Weave
With the prerequisites in place, you can set up the OTEL exporter and tracer provider that forward span data to Weave. The following code snippet demonstrates how to configure an OTLP span exporter and tracer provider to send OTEL traces from an ADK application to Weave.
To ensure that Weave traces ADK properly, set the global tracer provider before using ADK components in your code.
Trace ADK agents with OTEL
After you set up the tracer provider, you can create and run ADK agents with automatic tracing. The following example demonstrates how to create an LLM agent with a tool, and run it with an in-memory runner:
All agent operations are automatically traced and sent to Weave, so you can visualize the execution flow. You can view model calls, reasoning steps, and tool invocations.
This section shows how tool invocations appear in your traces when an agent uses more than one tool. When you define and use tools with ADK, the trace also captures these tool calls. The OTEL integration automatically instruments both the agent’s reasoning process and the individual tool executions, so you can see how your agent behaves end to end.
Here’s an example with multiple tools:
Work with workflow agents
Beyond single-agent setups, ADK supports composing multiple agents into workflows. The same OTEL configuration traces those flows without additional setup. ADK provides workflow agents for more complex scenarios. You can trace workflow agents just like regular LLM agents. The following example uses a SequentialAgent:
This workflow agent trace shows the sequential execution of both agents in Weave, which provides visibility into how data flows through your multi-agent system.
Learn more