Working with Google ADK

Instrument Google ADK pipelines with LangDB—capture nested agent flows, token usage, and latency metrics using a single init() call.

LangDB’s Google ADK integration provides end-to-end tracing for your ADK agent pipelines.

Installation

Enable end-to-end tracing for your Google ADK agents by installing the pylangdb client with the ADK feature flag:

Quick Start

Set your environment variables before initializing running the script:

Initialize LangDB before creating or running any ADK agents:

Once initialized, LangDB automatically discovers all agents and sub-agents (including nested folders), wraps their key methods at runtime, and links sessions for full end-to-end tracing across your workflow as well.

Complete Google ADK Python Example

Here's a full example of a Google ADK agent implementation that you can instrument with LangDB. This sample is based on the official Google ADK Quickstartarrow-up-right.

Example code

Check out the full sample on GitHub: https://github.com/langdb/langdb-samples/tree/main/examples/google-adk/multi-tool-agentarrow-up-right

Setup Environment

Project Structure

Create the following project structure:

init.py

Create an __init__.py file in the multi_tool_agent folder:

.env

Create .env file for your secrets

agent.py

Create an agent.py file with the following code:

Running Your Agent

Navigate to the parent directory of your agent project and use the following commands:

Open the URL provided (usually http://localhost:8000) in your browser and select "multi_tool_agent" from the dropdown menu.

Once your agent is running, try these example queries to test its functionality:

These queries will trigger the agent to use the functions we defined and provide responses based on the our agent workflow.

Traces on LangDB

When you run queries against your ADK agent, LangDB automatically captures detailed traces of all agent interactions:

Sample Traces of Google ADK Quick Start

Next Steps: Advanced Google ADK Integration

This guide covered the basics of integrating LangDB with Google ADK using a simple weather and time agent example. For more complex scenarios and advanced use cases, check out our comprehensive resources in Guides Section.

Last updated

Was this helpful?