Python SDK
Google ADK Integration
Track and observe Google ADK (Agent Development Kit) agents, tools, and runners.
The Google ADK integration allows you to trace your agent runs, tool calls, and LLM responses in Google's Agent Development Kit framework.
Setup
First, install the Google ADK extra dependencies:
pip install infralo[google-adk]To connect Infralo to a Google ADK agent, generate callback hooks using make_google_adk_callbacks and pass them when initializing your Agent.
make_google_adk_callbacks(infralo: Infralo)
This helper generates callback dictionary hooks (before_tool_callback, after_tool_callback, after_model_callback) bound to Infralo.
from infralo import Infralo
from infralo.integrations.google_adk import make_google_adk_callbacks
from google.adk.agents import Agent
infralo = Infralo()
# 1. Generate callbacks
callbacks = make_google_adk_callbacks(infralo)
# 2. Inject them into the Agent
agent = Agent(
name="my_agent",
tools=[my_tool],
**callbacks # Unpacks hooks for tool execution and LLM responses
)Usage Example
Run your Google ADK Runner inside an active trace context:
from infralo import Infralo
from infralo.integrations.google_adk import make_google_adk_callbacks
from google.adk.agents import Agent
from google.adk.runners import Runner
infralo = Infralo()
agent = Agent(name="my_agent", tools=[get_weather], **make_google_adk_callbacks(infralo))
runner = Runner(agent=agent)
# Run within an active trace
with infralo.start_trace(session_id="google-adk-session"):
async for event in runner.run_async("What is the weather in Tokyo?"):
print(event)What is Captured & Linked
The Google ADK integration captures:
- Tool Spans: Executed tools are tracked and timed.
- Inputs & Outputs: Input parameters and returns are logged to the span context.
- LLM Span Linking: The
after_model_callbackautomatically scans the ADKLlmResponsefor HTTP header metadata, extractingx-infralo-span-idto link downstream tool executions to the originating LLM call.
Complete Examples
You can view or download the complete, ready-to-run examples:
- google_adk_integration.py — Standard single-agent integration.
- google_adk_complex_nesting.py — Advanced multi-agent delegation and nested runners.