# Zep — Long-Term Memory for AI Agents and Assistants > Production memory layer for AI assistants. Zep stores conversation history, extracts facts, builds knowledge graphs, and provides temporal-aware retrieval for LLMs. ## Install Copy the content below into your project: ## Quick Use ```bash pip install zep-python ``` ```python from zep_python.client import AsyncZep client = AsyncZep(api_key="your-key") # Add a conversation await client.memory.add( session_id="session-123", messages=[ {"role": "user", "content": "I prefer dark mode in all my apps"}, {"role": "assistant", "content": "Noted! I'll remember your dark mode preference."}, ], ) # Retrieve memory memory = await client.memory.get(session_id="session-123") print(memory.facts) # ["User prefers dark mode"] ``` ## What is Zep? Zep is a production memory layer for AI assistants and agents. It goes beyond simple conversation history — Zep automatically extracts facts, builds user knowledge graphs, detects temporal context (when things happened), and provides intelligent retrieval so your AI remembers and reasons about past interactions. **Answer-Ready**: Zep is a production memory layer for AI agents that automatically extracts facts from conversations, builds knowledge graphs, and provides temporal-aware retrieval. Used in production by enterprise AI teams. Works with any LLM framework. **Best for**: AI teams building assistants that need to remember users across sessions. **Works with**: LangChain, LlamaIndex, OpenAI, Anthropic, any framework. **Setup time**: Under 5 minutes. ## Core Features ### 1. Automatic Fact Extraction ```python # User says: "I'm a software engineer at Google working on search" # Zep extracts: # - Fact: "User is a software engineer" # - Fact: "User works at Google" # - Fact: "User works on search" # All timestamped and linked to user entity ``` ### 2. Knowledge Graphs Zep builds entity-relationship graphs from conversations: ``` [User] --works_at--> [Google] [User] --role--> [Software Engineer] [User] --works_on--> [Search] [Google] --is_a--> [Tech Company] ``` ### 3. Temporal Awareness ```python # Zep understands time context # March: "I use React for frontend" # June: "I switched to Vue" # Query in July: "What framework does user use?" # Answer: "Vue" (Zep knows the React fact is outdated) ``` ### 4. Dialog Classification Automatically classifies conversation segments: ```python classifiers = await client.memory.get_session_classifiers(session_id="123") # {"sentiment": "positive", "topic": "technical_support", "intent": "troubleshooting"} ``` ### 5. Hybrid Search ```python # Search across all sessions for a user results = await client.memory.search( session_id="session-123", text="deployment issues", search_type="mmr", # Maximal Marginal Relevance limit=5, ) ``` ### 6. Framework Integrations ```python # LangChain from langchain_community.memory import ZepMemory memory = ZepMemory(session_id="123", url="http://localhost:8000") # LlamaIndex from llama_index.storage.chat_store.zep import ZepChatStore # Direct API from zep_python.client import AsyncZep ``` ## Architecture ``` Conversations → Zep Server ↓ ┌───────┴───────┐ │ Fact Extractor │ → Facts DB │ Graph Builder │ → Knowledge Graph │ Classifier │ → Session Metadata │ Embedder │ → Vector Index └───────────────┘ ↓ Intelligent Retrieval ↓ Your AI Agent ``` ## Deployment ```bash # Docker (self-hosted) docker compose up -d # Or use Zep Cloud (managed) # Sign up at zep.ai ``` ## FAQ **Q: How does Zep compare to Mem0?** A: Zep focuses on production features — knowledge graphs, temporal awareness, dialog classification. Mem0 is simpler with basic memory storage. Zep is more enterprise-oriented. **Q: Can I self-host?** A: Yes, open-source Community Edition available. Enterprise Edition adds advanced features. **Q: Does it handle PII?** A: Zep Cloud offers PII detection and redaction. Self-hosted users can add their own pipeline. ## Source & Thanks > Created by [Zep AI](https://github.com/getzep). Licensed under Apache 2.0. > > [getzep/zep](https://github.com/getzep/zep) — 3k+ stars ## 快速使用 ```bash pip install zep-python ``` 添加对话,Zep 自动提取事实和构建知识图谱。 ## 什么是 Zep? Zep 是生产级 AI 记忆层,自动从对话中提取事实、构建知识图谱、检测时间上下文,提供智能检索。 **一句话总结**:生产级 AI 记忆层,自动事实提取、知识图谱、时间感知检索,支持 LangChain 和 LlamaIndex。 **适合人群**:构建需要跨会话记忆用户的 AI 助手的团队。 ## 核心功能 ### 1. 自动事实提取 从对话中自动识别和存储关键事实。 ### 2. 知识图谱 构建实体关系图谱。 ### 3. 时间感知 理解事实的时效性,过期信息自动降权。 ### 4. 混合搜索 跨会话语义搜索。 ### 5. 框架集成 LangChain、LlamaIndex 一行接入。 ## 常见问题 **Q: 和 Mem0 比较?** A: Zep 更面向生产——知识图谱、时间感知、对话分类。Mem0 更简单基础。 **Q: 可以自托管?** A: 可以,开源社区版可用。 ## 来源与致谢 > [getzep/zep](https://github.com/getzep/zep) — 3k+ stars, Apache 2.0 --- Source: https://tokrepo.com/en/workflows/ffde39a9-bd16-4c41-8168-aacfb05b7622 Author: MCP Hub