Skip to content

LlamaIndex

Add Suprflo long-term memory to LlamaIndex retrievers and agents. Ships in the Python SDK.

Install

bash
pip install "suprflo[llamaindex]"

Targets llama-index-core >= 0.11.

What you get

All three are built on the Python SDK MemoryClient:

  • SuprfloMemory — a long-term memory that saves chat messages to Suprflo and recalls relevant ones as ChatMessages. Duck-types the BaseMemory method names (put, get, get_all, set, reset) rather than subclassing it, so it isn't pinned to one narrow version range.
  • SuprfloRetriever — a BaseRetriever that returns memories as NodeWithScore for RAG / query engines.
  • create_memory_tools(client, user_id) — LlamaIndex FunctionTools (save_memory, search_memory) to drop into an agent.

Memory

python
from llama_index.core.llms import ChatMessage
from suprflo import MemoryClient
from suprflo.integrations.llamaindex import SuprfloMemory

client = MemoryClient(api_key="YOUR_API_KEY")
memory = SuprfloMemory(client=client, user_id="alice")

memory.put(ChatMessage(role="user", content="I love hiking"))
memory.get("hobbies")   # -> [ChatMessage(role=SYSTEM, content="loves hiking")]

SuprfloMemory is a long-term memory, not a chat buffer. Suprflo stores derived memories rather than raw turns, so two things differ from ChatMemoryBuffer:

  • get_all() returns Alice's distilled memories, not verbatim chat history — don't use it to replay an exact transcript.
  • get(input) returns memories relevant to input, not the tail of the conversation. With no input it falls back to get_all().

Retriever for RAG

python
from suprflo.integrations.llamaindex import SuprfloRetriever

retriever = SuprfloRetriever(client=client, user_id="alice", top_k=5)
nodes = retriever.retrieve("dietary restrictions")   # [NodeWithScore, ...]

Each memory becomes a TextNode (memory id as id_, Suprflo metadata as metadata) wrapped in a NodeWithScore carrying the relevance score.

Tools for an agent

python
from suprflo.integrations.llamaindex import create_memory_tools

tools = create_memory_tools(client, user_id="alice")   # [save_memory, search_memory]
# add `tools` to your LlamaIndex agent's toolset

If llama-index-core isn't installed, importing this module raises a clear ImportError telling you to pip install "suprflo[llamaindex]".

The memory layer for AI agents.