Store sessions, memories, metrics, knowledge, evals, and traces as JSON files in Google Cloud Storage.
GcsJsonDb is a class that implements the Db interface using Google Cloud Storage as the backend storage system. Each table is stored as a JSON file in a GCS bucket.
Parameter
Type
Default
Description
id
Optional[str]
-
The ID of the database instance. UUID by default.
bucket_name
str
-
Name of the GCS bucket where JSON files will be stored.
prefix
Optional[str]
-
Path prefix for organizing files in the bucket. Defaults to "agno/".
session_table
Optional[str]
-
Name of the JSON file to store sessions (without .json extension).
memory_table
Optional[str]
-
Name of the JSON file to store user memories.
metrics_table
Optional[str]
-
Name of the JSON file to store metrics.
eval_table
Optional[str]
-
Name of the JSON file to store evaluation runs.
knowledge_table
Optional[str]
-
Name of the JSON file to store knowledge content.
culture_table
Optional[str]
-
Name of the JSON file to store cultural knowledge.
traces_table
Optional[str]
-
Name of the JSON file to store traces.
spans_table
Optional[str]
-
Name of the JSON file to store spans.
project
Optional[str]
-
GCP project ID. If None, uses default project.
credentials
Optional[Any]
-
GCP credentials. If None, uses default credentials.
Upsert multiple memories in one method call.Parameters:
memories (List[UserMemory]): List of memories to upsert
deserialize (Optional[bool]): Whether to deserialize the memories. Defaults to True
preserve_updated_at (bool): Whether to keep the memories' existing updated_at timestamps. Defaults to False
Returns:List[Union[UserMemory, Dict[str, Any]]]
GcsJsonDb accepts multiple records through the bulk methods but processes each record with an individual upsert. These methods do not reduce GCS read and write operations. In v2.7.2, preserve_updated_at is accepted but ignored, so an upsert replaces the existing timestamp.