Skip to main content

OpenInference Google GenAI Instrumentation

Python auto-instrumentation library for GenAI SDK. Traces are fully OpenTelemetry compatible and can be sent to any OpenTelemetry collector for viewing, such as Arize Phoenix or Arize AX.

Installation

pip install -Uqqq openinference-instrumentation-google-genai

Quickstart

Install openinference-instrumentation-google-genai and arize-phoenix.

pip install -U \
    openinference-instrumentation-google-genai \
    arize-phoenix \
    opentelemetry-sdk \
    opentelemetry-exporter-otlp \
    "opentelemetry-proto>=1.12.0"

Start the phoenix server so that it is ready to receive traces. The phoenix server runs entirely on your machine and does not send data over the internet.

phoenix serve

Instrumenting genai is simple.

from openinference.instrumentation.google_genai import GoogleGenAIInstrumentor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

endpoint = "http://127.0.0.1:4317"
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))

GoogleGenAIInstrumentor().instrument(tracer_provider=tracer_provider)

Now, all calls by generate_content are instrumented and can be viewed in the phoenix UI.

Supported APIs

This instrumentor traces the Google GenAI SDK, including generate_content (and its streaming variant), embed_content, Caches.create, the Interactions resource, Live sessions, and the Gemini Decisions API (client.decisions.create), which is traced as an OpenInference DECISION span. The Decisions API requires google-genai >= 3.2 and the v1beta API version (genai.Client(http_options={"api_version": "v1beta"})); on older SDK versions, which have no decisions resource, that tracing is skipped and the rest of the SDK is still instrumented. See examples/decisions.py for a runnable example.

Progress

This instrumentation is a work in progress

  • parse messages and invocation
  • capture tool definitions

More Info

Metadata

Release files for openinference-instrumentation-google-genai 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openinference-instrumentation-google-genai 1.7.0
File Size Uploaded Provenance Actions
openinference_instrumentation_google_genai-1.7.0.tar.gz 227.0 kB With provenance Details for openinference_instrumentation_google_genai-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openinference-instrumentation-google-genai 1.7.0
File Interpreter ABI Platform Actions
openinference_instrumentation_google_genai-1.7.0-py3-none-any.whl Python 3 none any Details for openinference_instrumentation_google_genai-1.7.0-py3-none-any.whl

Total release size: 285.5 kB

Release files / openinference_instrumentation_google_genai-1.7.0.tar.gz

Download URL openinference_instrumentation_google_genai-1.7.0.tar.gz
Size 227.0 kB
Tags Source
SHA-256 checksum
How to use checksums
834781a9fb1f0ebafb5927b3935a74605736bfbb3def4a9649dc7df8b863d752
BLAKE2b-256 checksum
How to use checksums
0a69e489ca9dc47f87de911cf3a780e581594b45a2d73bdb5b9d73b8485d4592
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / openinference_instrumentation_google_genai-1.7.0-py3-none-any.whl

Download URL openinference_instrumentation_google_genai-1.7.0-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57a548f2cafaf90c9098793005749bb6b6b53f6329cc6b2b1620bc152ec39c34
BLAKE2b-256 checksum
How to use checksums
7f56176a16573daaf5d98d600b7409a80e66a2abd4fe952022ba3f4f1e09b5a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for openinference-instrumentation-google-genai 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openinference_instrumentation_google_genai-1.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page