Quickstart
Get up and running with Zep in minutes
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’ll cover:
- Initializing the client
- Creating a user and session
- Adding messages and retrieving context with the memory API
- Adding business data to a user or group graph
- Searching for edges or nodes in the graph
Initialize the Client
First, install the Zep SDK for your preferred language. 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.
Create a User and Session
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.
Creating a User
Creating a Session
Adding Messages and Retrieving Context
Adding Messages with memory.add
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.
Retrieving Context with memory.get
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.
Adding Business Data to a 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.
Searching the Graph
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.
Using 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 Sessions in more detail
- Learn about Memory Context for building better prompts
- Explore Graph Search for advanced search capabilities