Skip to content

thrindex/thrindex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thrindex - The memory OS for AI agents

Not storage. Not RAG. A cognition engine that ranks, compresses and evolves agent memory across any model, any framework, at any scale.


Website · Docs · Get started



PyPI version npm version Docs


What is Thrindex?

Thrindex is a memory layer for AI agents. Your agent writes what it learns and retrieves what it needs - automatically, at every turn.

  • Persistent memory across sessions, users and agents
  • Semantic search powered by multi-signal fusion ranking
  • p99 retrieval under 100ms - so your agents never wait on memory
  • LLM extraction - send raw conversation turns, get clean facts stored automatically

Install

# Python
pip install thrindex

# TypeScript / JavaScript
npm install thrindex

Quickstart

Three lines to add memory to any agent.

Python

from thrindex import Thrindex

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

# Store a memory
memory_id = client.add(
    "User prefers concise responses and dislikes jargon",
    agent_id="my-agent",
    user_id="user-42",
)

# Retrieve relevant memories
memories = client.search(
    "how should I respond to this user?",
    agent_id="my-agent",
    user_id="user-42",
)

for m in memories:
    print(m.content, m.score)

TypeScript

import { ThrindexClient } from 'thrindex';

const client = new ThrindexClient({ apiKey: 'th_live_...' });

// Store a memory
const id = await client.add({
  content: 'User prefers concise responses and dislikes jargon',
  agentId: 'my-agent',
  userId: 'user-42',
});

// Retrieve relevant memories
const memories = await client.search({
  query: 'how should I respond to this user?',
  agentId: 'my-agent',
  userId: 'user-42',
});

Async Python

from thrindex import AsyncThrindex

async with AsyncThrindex(api_key="th_live_...") as client:
    memory_id = await client.add(
        "User is based in Berlin and works in fintech",
        agent_id="my-agent",
        user_id="user-42",
    )

Integrations

Drop Thrindex into your existing LLM calls with one wrapper. Memories are injected into every request and captured from every response - automatically.

OpenAI

from openai import OpenAI
from thrindex import Thrindex
from thrindex.integrations.openai import ThrindexOpenAI

openai_client = OpenAI(api_key="sk-...")
thrindex_client = Thrindex(api_key="th_live_...")

# Wrap your OpenAI client - nothing else changes
client = ThrindexOpenAI(
    thrindex_client=thrindex_client,
    openai_client=openai_client,
    agent_id="my-agent",
    user_id="user-42",
)

# Relevant memories are injected automatically.
# The conversation turn is captured and stored after the call.
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "What do you know about me?"}],
)
import OpenAI from 'openai';
import { ThrindexClient } from 'thrindex';
import { ThrindexOpenAI } from 'thrindex/integrations/openai';

const openai = new OpenAI({ apiKey: 'sk-...' });
const thrindex = new ThrindexClient({ apiKey: 'th_live_...' });

const client = new ThrindexOpenAI({ openai, thrindex, agentId: 'my-agent', userId: 'user-42' });

const response = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'What do you know about me?' }],
});

Anthropic

from anthropic import Anthropic
from thrindex import Thrindex
from thrindex.integrations.anthropic import ThrindexAnthropic

client = ThrindexAnthropic(
    thrindex_client=Thrindex(api_key="th_live_..."),
    anthropic_client=Anthropic(api_key="sk-ant-..."),
    agent_id="my-agent",
    user_id="user-42",
)

response = client.messages.create(
    model="claude-opus-4-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "What are my preferences?"}],
)
import Anthropic from '@anthropic-ai/sdk';
import { ThrindexClient } from 'thrindex';
import { ThrindexAnthropic } from 'thrindex/integrations/anthropic';

const client = new ThrindexAnthropic({
  anthropic: new Anthropic({ apiKey: 'sk-ant-...' }),
  thrindex: new ThrindexClient({ apiKey: 'th_live_...' }),
  agentId: 'my-agent',
  userId: 'user-42',
});

LangChain

from thrindex.integrations.langchain import ThrindexMemory

memory = ThrindexMemory(
    api_key="th_live_...",
    agent_id="my-agent",
    user_id="user-42",
)
import { ThrindexMemory } from 'thrindex/integrations/langchain';

const memory = new ThrindexMemory({
  apiKey: 'th_live_...',
  agentId: 'my-agent',
  userId: 'user-42',
});

LLM Extraction

By default, Thrindex runs gpt-5.4-nano on every write to extract clean, discrete facts from raw text before storing. Send a full conversation turn - get structured memories out.

# Send raw text - thrindex extracts and stores the facts
client.add(
    "I was chatting with the user about their stack. They said they use FastAPI "
    "for the backend and Next.js on the frontend. They mentioned they hate ORMs.",
    agent_id="my-agent",
    user_id="user-42",
)
# Stored as: "User uses FastAPI for backend"
#            "User uses Next.js for frontend"
#            "User dislikes ORMs"

When you already have a clean fact, bypass extraction entirely:

client.add(
    "User speaks Greek and English",
    agent_id="my-agent",
    user_id="user-42",
    extract=False,  # stored verbatim, no LLM call
)

Memory Scoping

Every memory is scoped to an agent_id and a user_id. You control the scope at search and list time by omitting either field.

agent_id user_id Scope
"my-agent" "user-42" Memories for this specific user with this agent
"my-agent" omitted All users' memories for this agent
omitted "user-42" This user's memories across all your agents
omitted omitted Everything in your organisation
# One user, one agent (most common)
client.search("query", agent_id="my-agent", user_id="user-42")

# All users for one agent - useful for shared/global agent context
client.search("query", agent_id="my-agent")

# One user across all agents - useful for a unified user profile
client.search("query", user_id="user-42")

API Reference

Method Description
add(content, agent_id, user_id, ...) Store a memory
search(query, agent_id, user_id, ...) Semantic search with multi-signal ranking
list(agent_id, user_id, ...) Paginated list of memories
get(memory_id) Fetch a single memory by ID
delete(memory_id, hard=False) Soft delete or GDPR erasure
batch_add(memories, agent_id, user_id) Store multiple memories

Full documentation at docs.thrindex.com.


Why Thrindex?

Thrindex Competitors
LLM extraction ✅ gpt-5.4-nano
Async Python client Partial
TypeScript SDK Partial
OpenAI / Anthropic hooks
LangChain / LlamaIndex

Built by thrindex.com · Get started free


License

Apache 2.0 - see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors