Skip to main content
The LlamaIndex integration provides two Python components that slot into standard LlamaIndex query pipelines.
ComponentInterfaceUse case
ThrindexMemoryPostprocessorBaseNodePostprocessorInject memories as extra nodes before LLM synthesis
ThrindexMemoryReaderBaseReaderLoad memories as Document objects for indexing or retrieval

Install

pip install 'thrindex[llamaindex]'

ThrindexMemoryPostprocessor

Retrieves relevant Thrindex memories and injects them as additional TextNode objects at the front of the node list before LLM synthesis. Attach it to any RetrieverQueryEngine or QueryPipeline.
from thrindex import Thrindex
from thrindex.integrations.llamaindex import ThrindexMemoryPostprocessor

client = Thrindex(api_key="th_live_...")

postprocessor = ThrindexMemoryPostprocessor(
    thrindex_client=client,
    agent_id="support-agent",
    user_id="user-42",
    k=5,               # memory nodes to inject per query, default 5
    task_context=None, # optional Thrindex ranking hint
    min_score=0.0,     # only inject memories at or above this score, default 0.0
)
Attach to a RetrieverQueryEngine:
from llama_index.core.query_engine import RetrieverQueryEngine

engine = RetrieverQueryEngine(
    retriever=your_retriever,
    node_postprocessors=[postprocessor],
)
response = engine.query("What are this user's preferences?")
Injected TextNode metadata includes source: "thrindex_memory", memory_id, agent_id, user_id, importance, level, and created_at.

ThrindexMemoryReader

A BaseReader that loads Thrindex memories as LlamaIndex Document objects. Use it to seed an index with an agent’s memory corpus, or to pull memories into a retrieval pipeline.
from thrindex.integrations.llamaindex import ThrindexMemoryReader

reader = ThrindexMemoryReader(
    thrindex_client=client,
    agent_id="support-agent",
    user_id="user-42",
    k=10,  # documents per query, default 10
)

documents = reader.load_data(query="user notification preferences")
If query is empty, the reader searches using "important context and preferences" as a default query, returning the most important recent memories.