Skip to main content
Google provides two SDKs relevant for tracing. Choose based on what you’re building:

Google ADK

Install:
Register AgentXADKPlugin in the plugins list when constructing the ADK Runner. Every subsequent runner.run() call is traced automatically.

What gets traced

AgentXADKPlugin reference


Google Gen AI (raw Gemini API)

Install:
Call patch_genai_client() once after creating your genai.Client. All subsequent client.models.generate_content() calls are traced automatically. Works with the async client too - pass client.aio (or client.aio.models) instead of client to trace await client.aio.models.generate_content(...) and async for chunk in await client.aio.models.generate_content_stream(...) calls.
To trace the async client, patch genai_client.aio instead of genai_client:

patch_genai_client() reference

Calling patch_genai_client() on an already-patched client is a no-op.
Call tracer.flush() before your process exits in scripts or one-shot jobs. In long-running servers it is not required: traces drain automatically in the background.