# 0Latency — Full Technical Reference > Memory Layer for AI Agents 0Latency provides automatic memory extraction, structured storage with temporal dynamics, and proactive recall with context budget management for AI agents. Give your agents persistent, intelligent memory without managing vector databases or writing extraction prompts. ## What It Does 0Latency sits between your AI agent and its conversations. It automatically extracts memories from interactions, stores them with rich metadata and temporal awareness, and proactively recalls relevant context when your agent needs it — all while respecting your token budget. ## Key Features - **6 Memory Types**: Facts, preferences, events, relationships, procedures, and emotional context — each with type-specific storage and retrieval optimizations - **Temporal Intelligence**: Memories decay over time using a half-life model and reinforce on access, so recent and frequently-used memories naturally surface first - **Graph Memory**: Relationship traversal via Postgres recursive CTEs — no Neo4j dependency, no separate graph database to manage. Free on all plans. - **Negative Recall**: Explicitly track what an agent should NOT remember or act on (corrections, retractions, outdated info) - **Contradiction Detection**: Automatically flags when new information conflicts with existing memories, with configurable resolution strategies - **Context Budget Management**: L0/L1/L2 tiered loading system — L0 (critical identity) always loads, L1 (session-relevant) loads on match, L2 (deep archive) loads only on explicit recall - **Session Handoff**: Transfer memory context between agents or sessions with a single API call - **Webhooks**: Real-time notifications for memory events (extraction, contradiction, decay threshold) - **Batch Operations**: Bulk import, export, and manage memories efficiently ## How It's Different | | 0Latency | Mem0 | Zep | Letta | |---|---|---|---|---| | Temporal decay/reinforcement | ✅ Built-in | ❌ | ❌ | ❌ | | Proactive recall | ✅ | ❌ Manual query | ❌ Manual query | Partial | | Context budgets (L0/L1/L2) | ✅ | ❌ | ❌ | ❌ | | Graph memory | ✅ All plans | Enterprise only | ❌ | ❌ | | Criteria scoring (no extra LLM) | ✅ | ❌ LLM rerank | ❌ LLM rerank | ❌ | | Negative recall | ✅ | ❌ | ❌ | ❌ | | Contradiction detection | ✅ | ❌ | ❌ | ❌ | --- ## Full API Reference Base URL: `https://api.0latency.ai/v1` Authentication: Include `Authorization: Bearer YOUR_API_KEY` header with all requests. ### Core Endpoints #### POST /extract Extract memories from a conversation or text. **Request:** ```json { "agent_id": "my-agent", "content": "User said they prefer dark mode and live in Portland.", "session_id": "optional-session-id", "metadata": {} } ``` **Response:** ```json { "memories_stored": 2, "entities_extracted": 3, "relationships_created": 1, "sentiment_analyzed": true, "memories": [ { "id": "mem_abc123", "type": "preference", "content": "Prefers dark mode", "confidence": 0.95, "created_at": "2026-03-30T00:00:00Z" } ] } ``` #### POST /recall Proactively recall relevant memories for a given context. **Request:** ```json { "agent_id": "my-agent", "context": "User is asking about UI settings", "max_tokens": 2000, "max_memories": 10 } ``` **Response:** ```json { "memories": [...], "total_tokens": 1450, "budget_used": 0.72 } ``` #### GET /memories List and search stored memories. **Query parameters:** - `agent_id` (required) — Filter by agent - `type` — Filter by memory type (fact, preference, event, relationship, procedure, emotional) - `search` — Full-text search query - `limit` — Max results (default 50) - `offset` — Pagination offset - `min_confidence` — Minimum confidence threshold (0-1) #### GET /memories/:id Get a specific memory by ID. #### DELETE /memories/:id Delete a specific memory. #### GET /health Service health check. Returns `{ "status": "ok" }`. ### Graph Endpoints #### GET /graph/relationships Query the relationship graph. **Query parameters:** - `agent_id` (required) - `entity` — Filter by entity name - `type` — Filter by relationship type #### GET /graph/traverse Traverse connections from a memory node. **Query parameters:** - `agent_id` (required) - `start_entity` — Entity to start traversal from - `depth` — Max traversal depth (default 2) - `limit` — Max results #### POST /graph/connect Create an explicit relationship between memories. **Request:** ```json { "agent_id": "my-agent", "source_entity": "Justin", "target_entity": "0Latency", "relationship": "founded" } ``` ### Batch Endpoints #### POST /batch/extract Bulk extract from multiple conversations. **Request:** ```json { "agent_id": "my-agent", "items": [ { "content": "conversation 1 text" }, { "content": "conversation 2 text" } ] } ``` #### POST /batch/import Import memories from external sources. #### GET /batch/export Export all memories for an agent. Returns JSON array of all memories. ### Webhook Endpoints #### POST /webhooks Register a webhook for memory events. **Request:** ```json { "agent_id": "my-agent", "url": "https://your-server.com/webhook", "events": ["memory.created", "contradiction.detected", "memory.decayed"] } ``` #### GET /webhooks List registered webhooks. #### DELETE /webhooks/:id Remove a webhook. --- ## SDK Examples ### Python SDK Install: `pip install 0latency` ```python from zerolatency import ZeroLatency client = ZeroLatency(api_key="your-api-key") # Extract memories from text result = client.extract( agent_id="my-agent", content="User prefers dark mode and lives in Portland, Oregon." ) print(f"Stored {result.memories_stored} memories") # Recall relevant memories memories = client.recall( agent_id="my-agent", context="User is asking about their account settings", max_tokens=2000 ) for mem in memories.memories: print(f"[{mem.type}] {mem.content} (confidence: {mem.confidence})") # List all memories all_memories = client.memories.list(agent_id="my-agent", limit=100) # Delete a memory client.memories.delete("mem_abc123") # Graph traversal graph = client.graph.traverse( agent_id="my-agent", start_entity="Justin", depth=2 ) for node in graph.nodes: print(f"{node.entity} --{node.relationship}--> {node.target}") ``` ### JavaScript/TypeScript SDK Install: `npm install @0latency/sdk` ```javascript import { ZeroLatency } from '@0latency/sdk'; const client = new ZeroLatency({ apiKey: 'your-api-key' }); // Extract memories const result = await client.extract({ agentId: 'my-agent', content: 'User prefers dark mode and lives in Portland, Oregon.' }); console.log(`Stored ${result.memoriesStored} memories`); // Recall relevant memories const memories = await client.recall({ agentId: 'my-agent', context: 'User is asking about their account settings', maxTokens: 2000 }); memories.memories.forEach(mem => { console.log(`[${mem.type}] ${mem.content} (${mem.confidence})`); }); // List memories const all = await client.memories.list({ agentId: 'my-agent', limit: 100 }); // Delete a memory await client.memories.delete('mem_abc123'); // Graph traversal const graph = await client.graph.traverse({ agentId: 'my-agent', startEntity: 'Justin', depth: 2 }); ``` --- ## MCP Server Configuration 0Latency provides an MCP (Model Context Protocol) server for direct integration with Claude Desktop, Claude Code, Cursor, Windsurf, and other MCP-compatible clients. ### Claude Desktop / Claude Code / Cursor Add to your MCP config (`claude_desktop_config.json` or equivalent): ```json { "mcpServers": { "0latency-memory": { "command": "npx", "args": ["-y", "@0latency/mcp"], "env": { "ZEROLAT_API_KEY": "your-api-key" } } } } ``` ### Install via Smithery ```bash npx -y @smithery/cli install @0latency/mcp --client claude ``` Smithery listing: https://smithery.ai/servers/zerolatency/memory ### Available MCP Tools - `memory_extract` — Extract and store memories from text - `memory_recall` — Recall relevant memories for context - `memory_list` — List stored memories with filters - `memory_delete` — Remove a specific memory - `graph_traverse` — Explore entity relationships --- ## Pricing | Plan | Memories | Agents | Price | Features | |---|---|---|---|---| | **Free** | 10,000 | 5 | $0/mo | Core API, graph memory, community support | | **Pro** | 100,000 | 25 | $29/mo | All features, webhooks, priority support, batch ops | | **Scale** | 1,000,000 | Unlimited | $89/mo | Everything in Pro + higher rate limits, SLA, dedicated support | | **Enterprise** | Custom | Unlimited | Custom | On-prem option, custom integrations, dedicated infrastructure | All plans include: graph memory, contradiction detection, temporal decay, negative recall, MCP server access. --- ## Links - Website: https://0latency.ai - Documentation: https://0latency.ai/docs/ - Pricing: https://0latency.ai/pricing.html - Chrome Extension: https://0latency.ai/chrome-extension.html - Blog: https://0latency.ai/blog/ - GitHub: https://github.com/0latency-ai/memory-engine - Smithery: https://smithery.ai/servers/zerolatency/memory - Support: https://0latency.ai/support.html - Security: https://0latency.ai/security.html - Summary (llms.txt): https://0latency.ai/llms.txt ## Integration Guides - MCP Server: https://0latency.ai/integrations/mcp.html - LangChain: https://0latency.ai/integrations/langchain.html - CrewAI: https://0latency.ai/integrations/crewai.html - AutoGen: https://0latency.ai/integrations/autogen.html - OpenClaw: https://0latency.ai/integrations/openclaw.html - Claude Desktop: https://0latency.ai/integrations/claude-desktop.html - Claude Code: https://0latency.ai/integrations/claude-code.html - Cursor: https://0latency.ai/integrations/cursor.html - Windsurf: https://0latency.ai/integrations/windsurf.html