Skip to main content
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. While optimized for Gemini and the Google ecosystem, ADK is model-agnostic and deployment-agnostic. It provides tools for creating, deploying, and orchestrating agentic architectures ranging from simple tasks to complex workflows. This guide 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.
For more information on OTEL tracing in Weave, see Send OTEL Traces to Weave.

Prerequisites

  1. Install the required dependencies:
  2. Set your Google API key as an environment variable:
  3. Configure OTEL tracing in Weave.

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.
It is recommended that you store sensitive environment variables like your API key and project info in an environment file (e.g., .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 are 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 (e.g., myteam/myproject)

Send OTEL traces from ADK 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 setting up the tracer provider, you can create and run ADK agents with automatic tracing. The following example demonstrates how to create a simple LLM agent with a tool, and run it with an in-memory runner:
All agent operations are automatically traced and sent to Weave, allowing you to visualize the execution flow. You can view model calls, reasoning steps, and tool invocations.
A trace visualization of an ADK agent

Trace ADK Tools with OTEL

When you define and use tools with ADK, these tool calls are also captured in the trace. The OTEL integration automatically instruments both the agent’s reasoning process and the individual tool executions, providing a comprehensive view of your agent’s behavior. Here’s an example with multiple tools:
A trace visualization of ADK tool calls

Work with Workflow Agents

ADK provides various workflow agents for more complex scenarios. You can trace workflow agents just like regular LLM agents. Here’s an example using a SequentialAgent:
This workflow agent trace will show the sequential execution of both agents in Weave, providing visibility into how data flows through your multi-agent system.
A trace visualization of a Sequential workflow agent

Learn more