Quickstart
Zep is a context engineering platform that systematically assembles personalized context—user preferences, traits, and business data—for reliable agent applications. Zep combines agent memory, Graph RAG, and context assembly capabilities to deliver comprehensive personalized context that reduces hallucinations and improves accuracy. This quickstart will walk you through Zep’s two core capabilities: giving your agent persistent memory of user interactions through Agent Memory, and providing your agent with up-to-date knowledge through Dynamic Graph RAG.
Looking for a more in-depth understanding? Check out our Key Concepts page.
Migrating from Mem0? Check out our Mem0 Migration guide.
Make sure to set up your environment before getting started.
Provide your agent with up-to-date user memory (Agent Memory)
Create user graph
It is important to provide at least the first name and ideally the last name of the user when calling user.add
. Otherwise, Zep may not be able to correctly associate the user with references to the user in the data you add. If you don’t have this information at the time the user is created, you can add it later with our update user method.
Create thread
Add messages
Add chat messages to a thread using the thread.add_messages
method. These messages will be stored in the thread history and used to build the user’s knowledge graph.
It is important to provide the name of the user in the name field if possible, to help with graph construction. It’s also helpful to provide a meaningful name for the assistant in its name field.
Add business data (Optional)
You can add business data directly to a user’s graph using the graph.add
method. This data can be in the form of messages, text, or JSON.
Retrieve context
Use the thread.get_user_context
method to retrieve relevant context for a thread. This includes a context block with facts and entities that can be used in your prompt.
Zep’s context block can either be in summarized or basic form (summarized by default). Retrieving basic results reduces latency (P95 < 200 ms). Read more about Zep’s context block here.
Summary (default)
Basic (fast)
You can also directly search the user graph and assemble the context block for more customized results.
View your knowledge graph
Since you’ve created memory, you can view your knowledge graph by navigating to the Zep Dashboard, then Users > “user123” > View Graph. You can also click the “View Episodes” button to see when data is finished being added to the knowledge graph.
Explore further
Refer to our agent memory walk-through for a more complete example.
Provide your agent with up-to-date knowledge (Dynamic Graph RAG)
Create graph
Add data
You can add business data directly to a graph using the graph.add
method. This data can be in the form of text or JSON.
Search the graph
Use the graph.search
method to search for edges, nodes, or episodes in the graph. This is useful for finding specific information about a user or graph.
Assemble context block
Using the search results, you can build a context block to include in your prompts. For a complete example with helper functions and code samples, see our Customize your context block cookbook.
View your knowledge graph
Since you’ve created memory, you can view your knowledge graph by navigating to the Zep Dashboard, then Users > “user123” > View Graph. You can also click the “View Episodes” button to see when data is finished being added to the knowledge graph.
Use Zep as an Agentic Tool
Zep’s memory retrieval methods can be used as agentic tools, enabling your agent to query Zep for relevant information. The example below shows how to create a LangChain LangGraph tool to search for facts in a user’s graph.
Next Steps
Now that you’ve learned the basics of using Zep, you can:
- Learn more about Key Concepts
- Explore the Graph API for adding and retrieving data
- Understand Users and Threads in more detail
- Learn about our Context Block for building better prompts
- Explore Graph Search for advanced search capabilities