Skip to content

SDK: Memory

The Memory API manages user/agent/app memories and vector store search. It provides sync and async clients with consistent method shapes.

Exports:

  • FlotorchMemory, FlotorchAsyncMemory – CRUD + search for memories
  • FlotorchVectorStore, FlotorchAsyncVectorStore – semantic search in a vector store

from flotorch.sdk.memory import (
FlotorchMemory,
FlotorchAsyncMemory,
FlotorchVectorStore,
FlotorchAsyncVectorStore,
)
API_KEY = "<your_api_key>"
BASE_URL = "https://gateway.flotorch.cloud"
PROVIDER = "<flotorch_memory_provider>" # FloTorch Memory Provider configured in the FloTorch Console
VECTORSTORE_ID = "<your_vectorstore_id>"

FlotorchMemory(
api_key: str,
base_url: str,
provider_name: str,
)
add(
messages: list[dict],
userId: str | None = None,
agentId: str | None = None,
appId: str | None = None,
sessionId: str | None = None,
metadata: dict | None = None,
timestamp: str | None = None,
providerParams: dict | None = None,
) -> dict
  • Adds one or more chat-style messages to memory.
get(memory_id: str) -> dict
  • Fetches a memory by id.
update(
memory_id: str,
content: str | None = None,
metadata: dict | None = None,
) -> dict
  • Updates memory content and/or metadata.
delete(memory_id: str) -> dict
  • Deletes a memory by id.
search(
userId: str | None = None,
agentId: str | None = None,
appId: str | None = None,
sessionId: str | None = None,
createFrom: str | None = None,
createTo: str | None = None,
updateFrom: str | None = None,
updateTo: str | None = None,
categories: list[str] | None = None,
metadata: dict | None = None,
page: int | None = 1,
limit: int | None = 20,
query: str | None = None,
) -> dict
  • Searches memories using rich filters. Returns provider-shaped payload.

Constructor:

FlotorchAsyncMemory(
api_key: str,
base_url: str,
provider_name: str,
)

Async equivalents of add, get, update, delete, and search are provided with the same parameters and return shapes.


Constructor:

FlotorchVectorStore(
base_url: str,
api_key: str,
vectorstore_id: str,
)
search(
query: str,
max_number_of_result: int | None = None,
ranker: str | None = None,
score_threshold: float | None = None,
rewrite_query: bool | None = None,
) -> dict
  • Runs semantic search. Optional parameters act as overrides.

Constructor:

FlotorchAsyncVectorStore(
base_url: str,
api_key: str,
vectorstore_id: str,
)

Async search with the same parameters as the sync client.


  • Provide valid provider_name configured in your FloTorch deployment.