Looking for a more in-depth understanding? Check out our Key Concepts page.
This quickstart guide will help you get up and running with Zep quickly. We will:
Migrating from Mem0? Check out our Mem0 Migration guide.
Create a free Zep account and you will be prompted to create an API key.
Set up your Python project, ideally with a virtual environment, and then:
Set up your TypeScript project and then:
Set up your Go project and then:
First, make sure you have a .env file with your API key:
After creating your .env file, you’ll need to source it in your terminal session:
Then, initialize the client with your API key:
The Python SDK Supports Async Use
The Python SDK supports both synchronous and asynchronous usage. For async operations, import AsyncZep instead of Zep and remember to await client calls in your async code.
Before adding messages, you need to create a user and a session. A session is a chat thread - a container for messages between a user and an assistant. A user can have multiple sessions (different conversation threads).
While messages are stored in sessions, the knowledge extracted from these messages is stored at the user level. This means that facts and entities learned in one session are available across all of the user’s sessions. When you use memory.get(), Zep returns the most relevant memory from the user’s entire knowledge graph, not just from the current session.
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.
Add chat messages to a session using the memory.add method. These messages will be stored in the session history and used to build the user’s knowledge graph.
It is important to provide the name of the user in the role field if possible, to help with graph construction. It’s also helpful to provide a meaningful name for the assistant in its role field.
Use the memory.get method to retrieve relevant context for a session. This includes a context string with facts and entities and recent messages that can be used in your prompt.
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.
You can add business data directly to a user’s graph or to a group graph using the graph.add method. This data can be in the form of messages, text, or JSON.
Use the graph.search method to search for edges or nodes in the graph. This is useful for finding specific information about a user or group.
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.
Now that you’ve learned the basics of using Zep, you can: