Skip to main content
JsonDb is a class that implements the Db interface using JSON files as the backend storage system. It provides a simple, file-based storage solution for agent sessions with each session stored in a separate JSON file.
ParameterTypeDefaultDescription
db_pathOptional[str]-Path to the directory where JSON files will be stored.
session_tableOptional[str]-Name of the JSON file to store sessions (without .json extension).
memory_tableOptional[str]-Name of the JSON file to store 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.

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