Skip to main content

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 invocation span with input/output values, user ID, and session ID
  • BaseAgent.run_async — creates an agent_run span 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otel_instrumentation_google_adk-0.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otel_instrumentation_google_adk-0.2.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file otel_instrumentation_google_adk-0.2.0.tar.gz.

File metadata

File hashes

Hashes for otel_instrumentation_google_adk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0ea9b65e770c68ee00c69df72169cc2005f4d7f2427823c0ebb1d71ebdbbe204
MD5 9e4584002ca55816bbc1da4d37528597
BLAKE2b-256 05d80493ddbd479408cdc2b51908b4d88fc4eea689f5b4f794736bf2421125c2

See more details on using hashes here.

File details

Details for the file otel_instrumentation_google_adk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for otel_instrumentation_google_adk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0ec6ed458396891ddb09a83a5fdf82aea8e02514ca787563183117dba1b46fd
MD5 24763fac843bfb44be5e015555a19115
BLAKE2b-256 5c284e775389d865fb1f6b3650e3f8b97ade79f2b3803ea161f4b8892d3af091

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page