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 will:
- Obtain an API key
- Install the SDK
- Initialize the client
- Create a user and session
- Add and retrieve messages
- View your knowledge graph
- Add business data to a user or group graph
- Search for edges or nodes in the graph
Obtain an API Key
Create a free Zep account and you will be prompted to create an API key.
Install the SDK
Python
Set up your Python project, ideally with a virtual environment, and then:
pip
uv
TypeScript
Set up your TypeScript project and then:
npm
yarn
pnpm
Go
Set up your Go project and then:
Initialize the Client
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.
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.
Create a User
Create a Session
Add 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.
Retrieve 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.
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.
Add 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.
Search 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.
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 Sessions in more detail
- Learn about Memory Context for building better prompts
- Explore Graph Search for advanced search capabilities