OpenTelemetry instrumentation for Google ADK (Agent Development Kit)
Project description
otel-instrumentation-google-adk
OpenTelemetry instrumentation for Google ADK (Agent Development Kit).
This instrumentor patches the Google ADK runner, agent, LLM, and tool layers to produce spans that follow the OpenTelemetry GenAI semantic conventions (gen_ai.* attributes). It is designed to work inside Google Agent Engine (GAE) where other telemetry libraries may be stripped.
Installation
pip install otel-instrumentation-google-adk
Usage
from otel_instrumentation_google_adk import GoogleADKInstrumentor
GoogleADKInstrumentor().instrument(tracer_provider=tracer_provider)
What gets instrumented
- Runner.run_async — creates an
invocationspan with input/output values, user ID, and session ID - BaseAgent.run_async — creates an
agent_runspan per agent with agent name and output - LLM calls — enriches spans with model name, input/output messages, token usage, temperature, and tool definitions
- Tool calls — enriches spans with tool name, description, input arguments, and output
Span attributes
Spans follow the OpenTelemetry GenAI semantic conventions:
| Attribute | Description |
|---|---|
gen_ai.operation.name |
invoke_agent, chat, or execute_tool |
gen_ai.system |
gcp.vertex_ai |
gen_ai.request.model |
Model name from the LLM request |
gen_ai.agent.name |
Agent name |
gen_ai.input.messages |
JSON-serialized input messages |
gen_ai.output.messages |
JSON-serialized output messages |
gen_ai.usage.input_tokens |
Input token count |
gen_ai.usage.output_tokens |
Output token count (candidates + thoughts) |
gen_ai.tool.name |
Tool name |
gen_ai.request.tools |
JSON-serialized tool definitions |
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file otel_instrumentation_google_adk-0.2.0.tar.gz.
File metadata
- Download URL: otel_instrumentation_google_adk-0.2.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ea9b65e770c68ee00c69df72169cc2005f4d7f2427823c0ebb1d71ebdbbe204
|
|
| MD5 |
9e4584002ca55816bbc1da4d37528597
|
|
| BLAKE2b-256 |
05d80493ddbd479408cdc2b51908b4d88fc4eea689f5b4f794736bf2421125c2
|
File details
Details for the file otel_instrumentation_google_adk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: otel_instrumentation_google_adk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0ec6ed458396891ddb09a83a5fdf82aea8e02514ca787563183117dba1b46fd
|
|
| MD5 |
24763fac843bfb44be5e015555a19115
|
|
| BLAKE2b-256 |
5c284e775389d865fb1f6b3650e3f8b97ade79f2b3803ea161f4b8892d3af091
|