Skip to main content
GcsJsonDb is a class that implements the Db interface using Google Cloud Storage as a database using JSON files. It provides high-performance, distributed storage for agent sessions with support for JSON data types and schema versioning.
ParameterTypeDefaultDescription
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.
projectOptional[str]-GCP project ID. If None, uses default project.
credentialsOptional[Any]-GCP credentials. If None, uses default credentials.

Methods

upsert_sessions

Bulk upsert multiple sessions for improved performance on large datasets. Parameters:
  • sessions (List[Session]): List of sessions to upsert
  • deserialize (Optional[bool]): Whether to deserialize the sessions. Defaults to True
Returns: List[Union[Session, Dict[str, Any]]]

upsert_memories

Bulk upsert multiple memories for improved performance on large datasets. Parameters:
  • memories (List[UserMemory]): List of memories to upsert
  • deserialize (Optional[bool]): Whether to deserialize the memories. Defaults to True
Returns: List[Union[UserMemory, Dict[str, Any]]]
I