Introduction
Every developer building with LLMs hits the same wall: agents forget everything between sessions. You wire up LangChain, deploy a support bot, and watch it treat returning users like strangers. The conversation history vanishes. Tool call outcomes evaporate. The agent learns nothing from what it actually did—only what users said in the current context window.
This isn't a minor inconvenience. It's a structural limitation that forces expensive workarounds: bloated prompts, repeated context stuffing, or fragile state management that breaks when you scale beyond a prototype. MemoriLabs/Memori addresses this directly. It's agent-native memory infrastructure—a Python↗ Bright Coding Blog-based, LLM-agnostic layer that captures execution and conversation as structured, persistent state. With 15,590 GitHub stars and active development as of June 2026, Memori is designed for production deployment across managed cloud, single-tenant cloud, VPC, and on-premises environments.
The core premise is specific and technically distinct: memory from what agents do, not just what they say.
What is MemoriLabs/Memori?
MemoriLabs/Memori is open-source memory infrastructure maintained by Memori Labs, distributed under the Apache 2.0 license. It sits between your existing LLM providers and data infrastructure without requiring rip-and-replace migration. The project is primarily Python (per repo metadata) and provides SDKs for both Python and TypeScript/JavaScript↗ Bright Coding Blog.
The technical category is agent memory infrastructure—distinct from vector databases, simple conversation history stores, or prompt engineering techniques. Memori structures memory at three hierarchical levels: entity (the user or object being interacted with), process (the agent or program executing the interaction), and session (the current bounded interaction between entity and process). This tri-level attribution enables granular recall: an agent can retrieve what it learned about a specific user, what it learned from its own execution patterns, or what occurred in a particular session.
The project's relevance is timing-specific. As agents move from demos to production, the "amnesia problem" becomes a reliability and cost issue. Memori's LoCoMo benchmark results—81.95% accuracy using only 4.97% of full-context token footprint—demonstrate that structured memory can preserve reasoning quality without the linear cost growth of context window expansion.
Key Features
LLM-Agnostic Architecture
Memori registers with client instances rather than wrapping or replacing them. The TypeScript and Python SDKs use a .llm.register(client) pattern that intercepts completions without modifying your existing OpenAI, Anthropic, Gemini, DeepSeek, Grok, or Bedrock client code. This matters for teams with existing client instrumentation, retry logic, or observability hooks.
Structured Memory Extraction Beyond raw conversation logging, Memori's Advanced Augmentation extracts eight memory types in the background: attributes, events, facts, people, preferences, relationships, rules, and skills. This occurs asynchronously—"incurring no latency" per the documentation—so your synchronous completion path isn't blocked.
Multi-Platform Deployment The infrastructure supports managed cloud (Memori Cloud with API key provisioning), single-tenant cloud, VPC, and on-premises deployment. For teams with existing data infrastructure, Memori BYODB (Bring Your Own Database) integrates with databases including TiDB, avoiding data gravity concerns.
Framework Integrations Native support exists for Agno, LangChain, and Pydantic AI. The OpenClaw gateway plugin and Hermes Agent memory provider extend this to agent frameworks without SDK integration. MCP (Model Context Protocol) support enables one-command connection for Claude Code, Cursor, Codex, Warp, and Antigravity users.
Benchmark-Verified Efficiency The LoCoMo long-conversation memory benchmark shows Memori achieving 81.95% overall accuracy with 1,294 tokens per query average—67% fewer tokens than Zep and over 20x reduction versus full-context prompting. This translates directly to latency and cost improvements at scale.
Use Cases
Production Customer Support Agents A support agent handling multi-turn troubleshooting needs to recall not just what the user said, but what diagnostic tools were run and their outcomes. Memori's process-level memory preserves tool call history and results across sessions, so an agent doesn't re-ask for system information or re-run checks it performed yesterday.
Long-Running Personal Assistants Agents that build user models over weeks or months require preference extraction and relationship tracking. Memori's entity-level Advanced Augmentation automatically surfaces that a user prefers evening notifications, has a recurring meeting with specific attendees, or follows particular formatting conventions—without explicit programming.
Team-Shared Development Agents The MCP integration targets this specifically: coding agents that learn project conventions, reviewer preferences, and stack-specific patterns. New team members inherit this accumulated context immediately rather than reconstructing tribal knowledge. Memori's attribution model distinguishes between "what this specific developer prefers" and "what this codebase requires."
Multi-Step Research and Analysis Workflows Agents executing sequential tool calls—database queries, API lookups, calculations—benefit from session grouping and process-level memory. A financial analysis agent can recall that it already retrieved Q3 earnings for a given ticker in a previous session, avoiding redundant API calls and maintaining analytical continuity.
Compliance-Sensitive Enterprise Deployments The BYODB and on-premises deployment options, combined with explicit attribution tracking, support audit requirements. Every memory is traceable to entity, process, and session—providing provenance that simple conversation logging cannot.
Installation & Setup
Memori provides two primary SDK paths and multiple integration patterns.
SDK Installation
TypeScript/JavaScript:
npm install @memorilabs/memori
Python:
pip install memori
The CLI is bundled with the Python package and invoked via module execution:
python -m memori
API Key Provisioning
For Memori Cloud (managed option):
- Sign up at app.memorilabs.ai
- Generate an API key from the dashboard
- Export as environment variable:
export MEMORI_API_KEY=[api_key]
For LLM provider access (example: OpenAI):
export OPENAI_API_KEY=[your_openai_key]
Attribution Setup
Memori requires explicit attribution to create memories. The minimum viable configuration identifies the entity (typically your end user) and process (your agent or application):
TypeScript:
mem.attribution("12345", "my-ai-bot");
Python:
mem.attribution(entity_id="12345", process_id="my-ai-bot")
Without this step, Memori cannot persist memories—this is enforced by design, not oversight.
Session Management
Memori auto-manages sessions but exposes explicit control:
TypeScript:
mem.resetSession(); // Start new session
// or
mem.setSession(sessionId); // Resume specific session
Python:
mem.new_session() # Start new session
# or
mem.set_session(session_id) # Resume specific session
Optional: BYODB Configuration
For teams using their own database, consult the Memori BYODB documentation. TiDB Zero offers disposable development databases for evaluation.
Real Code Examples
Basic Python Integration with OpenAI
This example demonstrates the core pattern: register the client, set attribution, and use standard OpenAI completions with automatic memory persistence.
from memori import Memori
from openai import OpenAI
# Requires MEMORI_API_KEY and OPENAI_API_KEY in your environment
client = OpenAI()
mem = Memori().llm.register(client)
mem.attribution(entity_id="user_123", process_id="support_agent")
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "My favorite color is blue."}]
)
# Conversations are persisted and recalled automatically.
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "What's my favorite color?"}]
)
# Memori recalls that your favorite color is blue.
The Memori().llm.register(client) call returns a configured Memori instance that intercepts completions. No wrapper function replaces client.chat.completions.create—your existing code paths remain intact. The attribution call binds subsequent interactions to a specific user ("user_123") and agent instance ("support_agent"), enabling both entity-level and process-level recall.
TypeScript Equivalent with Method Chaining
import { OpenAI } from 'openai';
import { Memori } from '@memorilabs/memori';
// Requires MEMORI_API_KEY and OPENAI_API_KEY in your environment
const client = new OpenAI();
const mem = new Memori().llm
.register(client)
.attribution('user_123', 'support_agent');
async function main() {
await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: 'My favorite color is blue.' }],
});
// Conversations are persisted and recalled automatically in the background.
const response = await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: "What's my favorite color?" }],
});
// Memori recalls that your favorite color is blue.
}
The TypeScript SDK uses fluent method chaining for configuration. The .attribution() call here is part of the chain rather than a separate statement, but functionally equivalent to the Python version.
OpenClaw Gateway Plugin
For teams using OpenClaw as their agent gateway, Memori provides zero-code-change persistence:
openclaw plugins install @memorilabs/openclaw-memori
openclaw plugins enable openclaw-memori
openclaw memori init \
--api-key "YOUR_MEMORI_API_KEY" \
--entity-id "your-app-user-id" \
--project-id "my-project"
openclaw gateway restart
This plugin captures structured memory from conversation and agent execution—including tool calls, decisions, and outcomes—after each turn. The lifecycle hooks mean no agent code modification is required.
MCP One-Command Connection (Claude Code)
claude mcp add --transport http memori https://api.memorilabs.ai/mcp/ \
--header "X-Memori-API-Key: ${MEMORI_API_KEY}" \
--header "X-Memori-Entity-Id: your_username" \
--header "X-Memori-Process-Id: claude-code"
MCP support eliminates SDK integration for supported clients. The headers carry attribution and authentication; Memori handles memory persistence and recall transparently.
Advanced Usage & Best Practices
Attribution Strategy The entity/process/session model is powerful but requires thoughtful mapping. Consider: should a user's multiple devices share an entity ID? Should different agent versions share a process ID or diverge for A/B comparison? The documentation doesn't prescribe answers—these are architectural decisions with trade-offs in memory granularity and privacy boundaries.
Quota Management Free-tier Advanced Augmentation is rate-limited. Monitor usage via:
python -m memori quota
Or the web dashboard. The CLI falls back to .env files for configuration, which can create surprises in containerized deployments—prefer explicit environment variable injection in production.
Session Boundaries Auto-session management works for simple cases, but multi-step agent workflows benefit from explicit session control. A research agent might span hours; decide whether that constitutes one session or many based on your continuity requirements versus memory retrieval precision.
Database Selection for BYODB The README mentions TiDB specifically for zero-config development. For production BYODB, evaluate your existing infrastructure's consistency model and geographic distribution against Memori's requirements—details in the BYODB documentation.
Comparison with Alternatives
| Dimension | MemoriLabs/Memori | Zep | LangMem | Mem0 |
|---|---|---|---|---|
| Memory scope | Execution + conversation | Conversation | Conversation | Conversation |
| LLM coupling | Agnostic (register pattern) | Specific integrations | Framework-specific | Specific integrations |
| LoCoMo accuracy | 81.95% | Lower (per Memori benchmark) | Lower (per Memori benchmark) | Lower (per Memori benchmark) |
| Tokens/query | 1,294 (4.97% of full context) | ~3,900 (per Memori data) | Not specified | Not specified |
| Deployment | Cloud, VPC, on-prem, BYODB | Cloud-focused | Cloud-focused | Cloud-focused |
| Attribution model | Entity/Process/Session | User/Session | User/Session | User/Session |
Memori's execution-level memory and broader deployment flexibility are genuine differentiators, but this comes with integration complexity. Zep and Mem0 may offer faster setup for simple conversation persistence. LangMem's framework-native integration may appeal to teams fully committed to LangChain. The benchmark data comes from Memori's own evaluation—independent verification would strengthen confidence in the specific numbers, though the directional claim of structured memory efficiency is well-supported.
FAQ
Q: Is MemoriLabs/Memori free to use? A: The core SDK and basic Advanced Augmentation are free with rate limits. Higher quotas require signup; enterprise deployments have separate pricing.
Q: What license covers the project? A: Apache 2.0, confirmed in the repository LICENSE file and README badges.
Q: Does Memori work with streaming completions? A: Yes—supported for unstreamed, streamed, synchronous, and asynchronous patterns across all listed LLM providers.
Q: Can I use Memori without sending data to Memori Cloud? A: Yes, via BYODB or on-premises deployment. The open-source core supports self-hosted operation.
Q: What happens if I forget to set attribution? A: Memori cannot create memories without entity and process identification. Calls proceed but aren't persisted.
Q: How does Memori compare to simply storing conversation history in PostgreSQL↗ Bright Coding Blog? A: Raw storage lacks structured extraction, semantic retrieval, and the tri-level attribution model. Memori's value is in what it extracts and how it recalls, not just persistence.
Q: Is the 15,590 star count current? A: Per repository metadata as of the last commit date (2026-06-15). Check the repository for live counts.
Conclusion
MemoriLabs/Memori solves a specific, painful problem in production agent systems: the structural amnesia between sessions and the cost of context-window-based workarounds. Its technical approach—LLM-agnostic registration, tri-level attribution, and background structured extraction—is architecturally distinct from simpler conversation stores.
The project is best suited for teams moving beyond prototypes: those running multi-step agents, needing cross-session continuity, or operating under deployment constraints (VPC, on-premises, existing database infrastructure) that preclude fully managed solutions. The benchmark data and broad integration support suggest maturity, though teams should validate memory quality against their specific use cases.
For developers building agent-native applications where what the agent does matters as much as what users say, Memori provides infrastructure worth evaluating. Start with the Memori Cloud quickstart or explore the open-source repository for BYODB deployment.
Explore related memory infrastructure patterns in our coverage of [INTERNAL_LINK: vector-database-comparison] and agent architecture best practices.