Skip to main content

Google Cloud Storage

Serverless state storage using Google Cloud Storage buckets.

Setup

pip install google-cloud-storage
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json

Usage

from praisonai.persistence.factory import create_state_store

store = create_state_store(
    "gcs",
    bucket_name="my-praisonai-state",
    prefix="state/"
)

# Store state
store.set("session:123", {"messages": [], "context": {}})

# Retrieve state
state = store.get("session:123")

# With TTL (seconds)
store.set("cache:key", {"data": "value"}, ttl=3600)

Configuration

OptionDescription
bucket_nameGCS bucket name (required)
prefixObject prefix (default: praisonai_state/)
projectGCP project ID (optional)
credentials_pathService account JSON path (optional)

Best For

  • Serverless deployments on GCP
  • Cross-region state sharing
  • Integration with GCP services