MemexAI Docs
Memory that changes your agent's next response, backed by Postgres.
MemexAI gives agents durable memory that can actually influence the next response. It stores memory as scoped Markdown-like files in Postgres, injects the right context through a prompt block, and gives teams revisions, access logs, search, and an admin UI.
Start with the service
Recommended: Containerized service
Run MemexAI as a separate service, then connect over the TypeScript SDK, Python SDK, or MCP.
Admin Console
Inspect memory files, revisions, access logs, observability, tool calls, and background dreaming.
Advanced: Direct Postgres runtime
Skip the service only when your app intentionally owns database credentials.
How the two paths work
1. Recommended: containerized service
Run the MemexAI service alongside Postgres. Your app never gets database credentials; it connects to the service over HTTP with the TypeScript or Python SDK, or through MCP over SSE/stdio.
Use this when you want a deployable memory service with API key auth and the admin UI built in.
2. Advanced: direct Postgres runtime
Skip the MemexAI service container only when your JavaScript or Python app should own the Postgres connection directly. Your app imports the MemexAI runtime, passes a Postgres URL, runs migrations, and executes memory tools in-process.
Use this for embedded deployments, local experiments, or environments where sharing database credentials with the app is an intentional tradeoff.
Two integration paths
Agentic tools
Use this for most assistants. The model gets two tools, and your system prompt gets the MemexAI prompt block.
const system = await memory.getSystemPrompt('You are a helpful assistant with durable user memory.')
const tools = memory.createAgenticToolset()
// memory_memorize, memory_searchPass both system and tools into your model call. Tools store and retrieve memory; the prompt block is what makes stored memory available to the next answer.
Raw tools
Use this when your agent or application should manage memory files directly.
const tools = memory.createRawToolset()
// memory_list, memory_read, memory_write, memory_patch, memory_smart_readFramework adapters
Drop Memex into the framework you already use.
Vercel AI SDK
Use memory tools with generateText and streamText in TypeScript.
Anthropic SDK
Integrate with claude-opus-4-7 and other Claude models via @memexai/core.
LangChain
Add memory tools to LangChain agents in TypeScript or Python.
OpenAI SDK
Wire memory tool definitions into OpenAI chat completions calls.
LlamaIndex
Use FunctionTool memory tools with LlamaIndex agents in Python.
CrewAI
Add memory tools to CrewAI agents and crews in Python.
Shared memory can guide behavior
User memory stores per-user facts, preferences, and project state. Shared memory stores global guidance that every agent can read, such as tool rules, product policies, escalation criteria, and evaluation rubrics.
How MemexAI works
Understand the loop from model tool call to memory files, prompt injection, revisions, and later recall.
Memory tools
Choose between two agentic tools and the raw file-level tool set.
Prompt block
Make stored memory part of the system prompt so the next response can change.
Shared memory as behavior guide
Use shared memory files as durable tool guidance, policies, and behavior instructions for agents.
Why memory evals matter
Evaluate the memory state and memory writes, not only the prompt text.
What MemexAI stores
Memory lives in Postgres tables:
| Table | Purpose |
|---|---|
mx_file | Current memory file contents |
mx_revision | Full write snapshots for auditability |
mx_access_log | Lightweight read/write activity |
mx_migration | Applied schema migrations |
Agents use virtual paths like user/profile.md and shared/policy.md. MemexAI translates those paths to physical database paths and enforces user isolation.
Community / Support
Got a question, found a bug, or want to share how you're using MemexAI? Join us on Slack →