Skip to main content

Documentation Index

Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Automatically capture agent runs, tool executions, and the multi-turn agent loop within the Google Agent Development Kit (ADK).

Setup

import traceroot
from traceroot import Integration

traceroot.initialize(integrations=[Integration.GOOGLE_ADK])

Usage

Once initialized, ADK agent executions, tool calls, and underlying Gemini calls are captured automatically:
import asyncio
import traceroot
from traceroot import Integration
from google.adk.agents import Agent
from google.adk.runners import InMemoryRunner
from google.genai import types

traceroot.initialize(integrations=[Integration.GOOGLE_ADK])


def get_weather(city: str) -> dict:
    """Get current weather for a city."""
    return {"status": "success", "city": city, "temp": 72, "condition": "sunny"}


agent = Agent(
    name="assistant",
    model="gemini-2.5-flash",
    description="Helpful assistant with access to tools.",
    instruction="You are a helpful AI assistant. Use tools when needed.",
    tools=[get_weather],
)


async def main():
    runner = InMemoryRunner(agent=agent, app_name="traceroot-adk-demo")
    await runner.session_service.create_session(
        app_name="traceroot-adk-demo",
        user_id="demo-user",
        session_id="demo-session",
    )

    # The full run, including tool calls and Gemini calls, is traced
    async for event in runner.run_async(
        user_id="demo-user",
        session_id="demo-session",
        new_message=types.Content(
            role="user",
            parts=[types.Part(text="What's the weather in Tokyo?")],
        ),
    ):
        if event.is_final_response() and event.content and event.content.parts:
            print(event.content.parts[0].text)


if __name__ == "__main__":
    asyncio.run(main())
    traceroot.flush()

What Gets Captured

AttributeDescription
Agent runsEach runner.run_async() invocation
Agent stepsIndividual turns within the ADK agent loop
Tool callsEach tool invocation with input arguments and results
LLM callsRaw Gemini calls made by the ADK runtime
Tokens & CostAggregated token usage and pricing
LatencyDuration per agent run and per span

Run the example

Clone the repo and run a complete agent end-to-end.

Python

Run the Python example