Skip to main content
The Google Agent Development Kit (ADK) streamlines building, orchestrating, and tracing generative-AI agents out of the box, letting you move from prototype to production far faster than wiring everything yourself. For more details on ADK, refer to the official Google ADK documentation. LangWatch can capture traces generated by Google ADK by leveraging its built-in OpenTelemetry support. This guide will show you how to set it up.

Prerequisites

  1. Install LangWatch SDK:
  2. Install Google ADK and OpenInference instrumentor:
    Use openinference-instrumentation-google-adk>=0.1.11. Google ADK 1.32 moved trace_tool_call out of google.adk.flows.llm_flows.functions, so older instrumentor versions (≤0.1.10) crash with AttributeError: module 'google.adk.flows.llm_flows.functions' has no attribute 'trace_tool_call' on ADK ≥1.32. 0.1.11+ resolves the symbol per ADK version and works across both.
  3. Set up Google Cloud authentication: You’ll need to authenticate with Google Cloud. You can either:
    • Set the GOOGLE_API_KEY environment variable for Gemini API access
    • Use Application Default Credentials (ADC) if running on Google Cloud
    • Use service account keys for production deployments

Instrumentation with OpenInference

LangWatch supports seamless observability for Google ADK agents using the OpenInference Google ADK instrumentor. This approach automatically captures traces from your ADK agents and sends them to LangWatch.

Basic Setup (Automatic Tracing)

Here’s the simplest way to instrument your application:
That’s it! All Google ADK agent activity will now be traced and sent to your LangWatch dashboard automatically.

Optional: Using Decorators for Additional Context

If you want to add additional context or metadata to your traces, you can optionally use the @langwatch.trace() decorator:

How it Works

  1. langwatch.setup(): Initializes the LangWatch SDK, which includes setting up an OpenTelemetry trace exporter. This exporter is ready to receive spans from any OpenTelemetry-instrumented library in your application.
  2. GoogleADKInstrumentor(): The OpenInference instrumentor automatically patches Google ADK components to create OpenTelemetry spans for their operations, including:
    • Agent initialization
    • Tool calls
    • Model completions
    • Session management
  3. Optional Decorators: You can optionally use @langwatch.trace() to add additional context and metadata to your traces, but it’s not required for basic functionality.
With this setup, all agent interactions, tool calls, and model completions will be automatically traced and sent to LangWatch, providing comprehensive visibility into your ADK-powered applications.

Notes

  • You do not need to set any OpenTelemetry environment variables or configure exporters manually—langwatch.setup() handles everything.
  • You can combine Google ADK instrumentation with other instrumentors (e.g., OpenAI, LangChain) by adding them to the instrumentors list.
  • The @langwatch.trace() decorator is optional - the OpenInference instrumentor will capture all ADK activity automatically.
  • For advanced configuration (custom attributes, endpoint, etc.), see the Python integration guide.

Troubleshooting

  • Make sure your LANGWATCH_API_KEY is set in the environment.
  • If you see no traces in LangWatch, check that the instrumentor is included in langwatch.setup() and that your agent code is being executed.
  • Ensure you have the correct Google API key set for Gemini access.
  • AttributeError: module 'google.adk.flows.llm_flows.functions' has no attribute 'trace_tool_call' on langwatch.setup(): your openinference-instrumentation-google-adk is too old for your Google ADK version. ADK 1.32 removed that symbol; the fix shipped in instrumentor 0.1.11. Run pip install -U "openinference-instrumentation-google-adk>=0.1.11". If it still fails, confirm the upgrade actually applied in the running interpreter with pip show openinference-instrumentation-google-adk.

Interoperability with LangWatch SDK

You can use this integration together with the LangWatch Python SDK to add additional attributes to the trace:
This approach allows you to combine the automatic tracing capabilities of Google ADK with the rich metadata and custom attributes provided by LangWatch.