Skip to main content
JsonDb is a class that implements the Db interface using JSON files as the backend storage system. It provides simple, file-based storage with each table stored as a separate JSON file.

Methods

upsert_sessions

Upsert multiple sessions in one method call. Parameters:
  • sessions (List[Session]): List of sessions to upsert
  • deserialize (Optional[bool]): Whether to deserialize the sessions. Defaults to True
  • preserve_updated_at (bool): Whether to keep the sessions' existing updated_at timestamps. Defaults to False
Returns: List[Union[Session, Dict[str, Any]]]

upsert_memories

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]]]
In Agno v2.7.4, JsonDb.upsert_sessions() and JsonDb.upsert_memories() declare preserve_updated_at, but the JSON backend does not forward it to individual upserts. JsonDb does not preserve supplied updated_at values when this argument is True.