Skip to main content

Observability

Instrument your code with OpenTelemetry to capture traces, logs, and metrics for every LLM call, agent step, and tool use.

Observability

This guide covers Python. For Java installation and examples, see the Google ADK Java quickstart.

Getting Started

Google Agent Development Kit (ADK) is a flexible, model-agnostic framework for developing and deploying AI agents. ADK simplifies building complex agent architectures with workflow orchestration, tool integration, and multi-agent collaboration. Integrate with Toqan Router to monitor agent behavior, track tool usage, analyze workflows, and optimize your agent systems.

Prerequisites

Before you begin, ensure you have:
  • A Toqan Router account and API Key
  • Google API key (for model access)
  • Python 3.11+
  • Google ADK installed in your project

Install Dependencies

Python:

Configure Toqan Router

Set up your environment variables to connect to Toqan Router’s OpenTelemetry collector: Unix/Linux/macOS:
Windows (PowerShell):
Using .env file:

Integrations

Use the OpenInference Google ADK instrumentor to capture OpenInference spans and propagate trace context to model requests.

Instrument Google ADK

Initialize the integration before creating Gemini clients or running Agents. Pass the existing TracerProvider when OpenTelemetry is already configured. Call GoogleADKInstrumentor().instrument(tracer_provider=provider) once during startup.

Combine tracing with the AI Gateway

For model requests through /v3/google, follow the Google Gen AI SDK setup and keep the OTLP exporter and AI Gateway API keys scoped to the same Workspace and Project. The HTTP client instrumentation below propagates W3C traceparent and tracestate through HTTPX, Requests and aiohttp. Other transports need their own OpenTelemetry instrumentation. Forward these headers through any intermediate proxy. Requests sent through these instrumented HTTP clients carry the active span context. Do not set a fixed traceparent header or reuse one across an Agent session. After setup, confirm that the exported model span and its AI Gateway request share a trace ID. Correlated calls can then be counted once in Activity while both traces remain available.
To view more examples of ADK implementation, browse the Google ADK Samples repository

Next Steps

Verify your Traces in the Toqan Router Studio.
To learn more about the capabilities of Traces in Toqan Router, see Traces