Skip to main content
Agno supports using Google Cloud Storage (GCS) as a storage backend for Teams using the GcsJsonDb class. This storage backend stores session data as JSON blobs in a GCS bucket.

Usage

Configure your team with GCS storage to enable cloud-based session persistence.
gcs_for_team.py

Prerequisites

1

Google Cloud SDK Setup

  1. Install the Google Cloud SDK
  2. Run gcloud init to configure your account and project
2

GCS Permissions

Ensure your account has sufficient permissions (e.g., Storage Admin) to create and manage GCS buckets:
3

Authentication

Use default credentials from your gcloud CLI session:
Alternatively, if using a service account, set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your service account JSON file.
4

Python Dependencies

Install the required Python packages:
1

Setup with Docker

For local testing without using real GCS, you can use fake-gcs-server.Create a docker-compose.yml file:
Start the fake GCS server:
2

Using Fake GCS with Docker

Set the environment variable to direct API calls to the emulator:
When using Fake GCS, authentication isn't enforced and the client will automatically detect the emulator endpoint.

Params

ParameterTypeDefaultDescription
idOptional[str]-The ID of the database instance. UUID by default.
bucket_namestr-Name of the GCS bucket where JSON files will be stored.
prefixOptional[str]-Path prefix for organizing files in the bucket. Defaults to "agno/".
session_tableOptional[str]-Name of the JSON file to store sessions (without .json extension).
memory_tableOptional[str]-Name of the JSON file to store user memories.
metrics_tableOptional[str]-Name of the JSON file to store metrics.
eval_tableOptional[str]-Name of the JSON file to store evaluation runs.
knowledge_tableOptional[str]-Name of the JSON file to store knowledge content.
culture_tableOptional[str]-Name of the JSON file to store cultural knowledge.
traces_tableOptional[str]-Name of the JSON file to store traces.
spans_tableOptional[str]-Name of the JSON file to store spans.
projectOptional[str]-GCP project ID. If None, uses default project.
credentialsOptional[Any]-GCP credentials. If None, uses default credentials.