Skip to main content

Genkit Google Cloud Plugin

Export Genkit telemetry to Google Cloud Trace, Cloud Monitoring, and Cloud Logging.

Building with a coding agent? Install the Genkit Python skill first.

npx skills add genkit-ai/skills --skill developing-genkit-python

It teaches your agent the current Genkit Python APIs and common gotchas. Source, manual install and skills for other languages: genkit-ai/skills.

Installation

uv add genkit-google-cloud genkit-google-genai

Usage

from genkit import Genkit
from genkit_google_cloud import enable_google_cloud_telemetry
from genkit_google_genai import GoogleAI

enable_google_cloud_telemetry(project='my-project')

ai = Genkit(plugins=[GoogleAI()], model=GoogleAI.gemini('gemini-flash-latest'))

Requires Google Cloud Application Default Credentials (ADC) or explicit credentials.

Sampling

Every trace is exported by default (unless OTEL_TRACES_SAMPLER says otherwise). To export a fraction, pass sampler=. ParentBased keeps the caller's decision when a request arrives with a traceparent, so a trace that started upstream is not cut in half:

from opentelemetry.sdk.trace.sampling import ParentBased, TraceIdRatioBased

enable_google_cloud_telemetry(
    project='my-project',
    sampler=ParentBased(TraceIdRatioBased(0.1)),
)
# => about 1 in 10 new traces reach Cloud Trace

sampler= applies to the tracer provider this helper creates. If your app already set one, put the sampler on that provider instead; passing sampler= then raises INVALID_ARGUMENT:

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider

trace.set_tracer_provider(TracerProvider(sampler=ParentBased(TraceIdRatioBased(0.1))))
enable_google_cloud_telemetry(project='my-project')
# => Cloud Trace joins your provider and uses its sampler

Sessions on Firestore

FirestoreSessionStore persists agent sessions durably: every turn is stored as a snapshot, sessions survive restarts and resume across processes, and status subscriptions enable features like a cross-process stop button.

from genkit.exp import Genkit
from genkit_google_cloud.exp import FirestoreSessionStore

ai = Genkit()
store = FirestoreSessionStore()  # uses Application Default Credentials
agent = ai.define_agent(name='assistant', store=store)

Notes:

  • Data lives under three collection roots derived from collection (default genkit-sessions, plus -shards and -pointers). Delete all three together when cleaning up.
  • Multi-tenant apps pass snapshot_path_prefix to derive a per-tenant path segment from call context.
  • After a regenerate/branch, resume a specific branch by snapshot_id; session_id lookup follows the most recently written branch.
  • See the class docstring for costs, limits, and lifecycle details.

Metadata

Release files for genkit-google-cloud 0.13.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 genkit-google-cloud 0.13.0
File Size Uploaded Provenance Actions
genkit_google_cloud-0.13.0.tar.gz 74.5 kB With provenance Details for genkit_google_cloud-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for genkit-google-cloud 0.13.0
File Interpreter ABI Platform Actions
genkit_google_cloud-0.13.0-py3-none-any.whl Python 3 none any Details for genkit_google_cloud-0.13.0-py3-none-any.whl

Total release size: 122.1 kB

Release files / genkit_google_cloud-0.13.0.tar.gz

Download URL genkit_google_cloud-0.13.0.tar.gz
Size 74.5 kB
Tags Source
SHA-256 checksum
How to use checksums
beeb596c085cf9ad9f1891e4187de7918f4ddfd1500a933b7ef8c1481a4b9ec5
BLAKE2b-256 checksum
How to use checksums
b7f0dabe79dfb59d390623154867df1420d27d01fd6a2b4ed247aacd66880b07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 5, 2026.

Transparency log

Release files / genkit_google_cloud-0.13.0-py3-none-any.whl

Download URL genkit_google_cloud-0.13.0-py3-none-any.whl
Size 47.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
475ee2ba9ebf86c582d913378b52ae90d9d0742c0a25f6f6f170222f9d5c0c0f
BLAKE2b-256 checksum
How to use checksums
b5da978b8e24a67434b56800a348e6221706a7f8de33f293a3e4ef2a12d35a78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 5, 2026.

Transparency log

Security for genkit-google-cloud 0.13.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 genkit_google_cloud-0.13.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 Nov 5, 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.

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