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

Each model call and tool call also becomes its own real child span with per-call timing, so the trace dialog’s Timeline shows the invocation’s actual step sequence.

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 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:

What gets traced

By default, each generate_content() / generate_content_stream() call produces its own trace. Wrap a multi-call loop in with tracer.trace(...) to collapse the calls into one trace instead, exactly as in the Anthropic integration.

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.