Packages

A complete, production-grade Elixir client for the Zep AI memory API (Threads, Users, Graph, Context, Batch, Project, Task) with typed structs, retries, telemetry, and strict dialyzer/credo compliance.

Current section

Files

Jump to
zep lib zep.ex
Raw

lib/zep.ex

defmodule Zep do
@moduledoc """
A complete Elixir client for the [Zep](https://www.getzep.com) AI memory API.
Zep organizes agent memory around a few core resources, each with its own
module here:
* `Zep.Thread` (+ `Zep.Thread.Message`) - conversation threads and the
messages within them
* `Zep.User` - the identities threads and graph memory attach to
* `Zep.Context` - custom context-rendering templates
* `Zep.Graph` (+ `Zep.Graph.Edge`, `Zep.Graph.Episode`, `Zep.Graph.Node`,
`Zep.Graph.CustomInstructions`, `Zep.Graph.Observations`,
`Zep.Graph.ThreadSummaries`) - the temporal knowledge graph
* `Zep.Project` - project-level settings
* `Zep.Task` - async task/job status
* `Zep.Batch` - bulk ingestion jobs
## Quick start
client = Zep.Client.new(api_key: "z_...")
{:ok, user} = Zep.User.add(client, "user-1", first_name: "Ada", last_name: "Lovelace")
{:ok, thread} = Zep.Thread.create(client, "thread-1", "user-1")
{:ok, _} =
Zep.Thread.add_messages(client, "thread-1", [
%{role: "user", content: "Hi, I'm Ada.", name: "Ada"}
])
{:ok, %{context: context}} = Zep.Thread.get_user_context(client, "thread-1")
Every resource function returns `{:ok, result}` or `{:error, %Zep.Error{}}` /
`{:error, %Zep.TransportError{}}` - see `Zep.Error` for how to pattern-match
on specific failure reasons.
## Configuration
A client can be built explicitly with `Zep.Client.new/1`, or every resource
function can be called with a plain keyword list instead of a client and
configuration will be resolved implicitly from `Application` env / the
`ZEP_API_KEY` environment variable - see `Zep.Config` for precedence rules.
"""
end