# Zep to Hindsight Migration: Export Episodes, Load, What Changes

> Move Zep episodes to Hindsight (Dec 2026): export with Zep's list episodes API, load with batch retain, the field map, what does not carry over, and the LLM cost.

Source: https://aiagentmemory.org/articles/migrate-zep-to-hindsight/ · Updated 2026-12-03 · aiagentmemory.org


**There is no official migration tool from Zep to Hindsight.** You list the episodes of each Zep graph with Zep's API, then load them into Hindsight with batch retain. Hindsight re-reads each episode with an LLM and stores the facts it extracts. It does not copy Zep's graph, its entities or its fact validity dates. This page gives the steps, the field map, and what does not carry over.

## What is Hindsight?

**Hindsight is an open-source agent memory server from Vectorize, released under the MIT license.** Its operations are retain (store), recall (search) and reflect (reason over memories). Memories sit in banks. For Zep's user graphs, a bank per user keeps the same separation. The Hindsight facts here come from its retain docs, read 3 December 2026, and the `hindsight-client` 1.3.1 package on PyPI.

## Step 1: Export the episodes from Zep

In Zep v4, each user has a graph, and the user's uuid works as the graph uuid. The list episodes endpoint is `POST https://api.getzep.com/api/v4/graphs/{graph_uuid}/episodes/list`. It returns `items`, each with `content`, `created_at`, `reference_time`, `metadata`, and for chat messages `role` and `role_name`. It pages with `next_cursor`, and the request takes `page_size` as a query parameter. Source: Zep's v4 API reference, https://help.getzep.com/v4/sdk-reference/graph/episode/list (checked 4 December 2026): the path, `page_size` as a query parameter, `items` and `next_cursor` all match.

```python
import requests

ZEP_KEY = "YOUR_ZEP_API_KEY"
ZEP_URL = "https://api.getzep.com/api/v4/graphs/{graph}/episodes/list"

def export_graph(graph_uuid):
    cursor = None
    while True:
        params = {"page_size": 50}
        if cursor:
            params["cursor"] = cursor
        resp = requests.post(
            ZEP_URL.format(graph=graph_uuid),
            headers={"Authorization": f"Api-Key {ZEP_KEY}", "Content-Type": "application/json"},
            params=params,
            json={"filters": {}},
            timeout=60,
        )
        resp.raise_for_status()
        body = resp.json()
        for episode in body.get("items", []):
            yield episode
        cursor = body.get("next_cursor")
        if not cursor:
            break
```

The script reads one graph at a time. Keep the list of user uuids you want to move in your own app and pass each one in. Episodes that Zep dropped after waiting more than 7 days carry an `expired_at` field and are not in the graph. Add those again yourself if you still need them.

## Step 2: Map the fields

| Zep field | Hindsight field | Note |
|---|---|---|
| `content` | `content` | Only required field in Hindsight. For chat messages, put the speaker in the text, for example `role_name: content`. |
| `reference_time` | `timestamp` | ISO 8601. Use the time the memory happened, not the import time. |
| `uuid` | `document_id` | Re-sending the same id replaces that document, so re-runs do not duplicate. |
| graph (user) | bank (`bank_id`) | One bank per user. |
| `metadata` | `metadata` | Hindsight stores metadata values as strings, so convert them. |
| `role`, `role_name` | `context` or text | Zep keeps the sender as fields. Hindsight takes free text, so put the speaker in the content or in `context`. |

## Step 3: Load into Hindsight with batch retain

Hindsight's docs call batch ingestion "the recommended approach". Use `retain_batch`, which in `hindsight-client` 1.3.1 accepts `bank_id`, `items`, `document_id`, `document_tags`, `retain_async` and `operation_id`. The 50-item chunk size is ours. Hindsight's docs set no maximum item count.

```python
from hindsight_client import Hindsight

hs = Hindsight(base_url="http://localhost:8888")  # your Hindsight server

def load_user(graph_uuid):
    batch = []
    for ep in export_graph(graph_uuid):
        speaker = f"{ep['role_name']}: " if ep.get("role_name") else ""
        batch.append({
            "content": speaker + ep["content"],
            "timestamp": ep["reference_time"],
            "document_id": ep["uuid"],
            "context": "zep import",
            "metadata": {k: str(v) for k, v in (ep.get("metadata") or {}).items()},
        })
        if len(batch) == 50:
            hs.retain_batch(bank_id=graph_uuid, items=batch)
            batch = []
    if batch:
        hs.retain_batch(bank_id=graph_uuid, items=batch)
```

We did not run this against a live Zep project or Hindsight server. Check the field names against one real Zep response first, then test one user before a full run.

## What does not carry over

- **Zep's graph.** Zep builds entities and temporal facts from your episodes. Hindsight builds its own facts, entities, observations and mental models from the same text, so the graph will not match.
- **Fact validity dates.** Zep tracks when a fact became true or stopped being true. Hindsight stores times from the text and the `timestamp` you send. Check any fact that changed over time with `recall`.
- **Zep's search scores.** Hindsight ranks results with its own recall (four strategies in parallel, then a rerank). Scores do not match.
- **Expired episodes.** Zep drops episodes that wait more than 7 days and marks them with `expired_at`. Those are not in the graph and are not exported.
- **Content policy state.** Zep's `content_policy` field has no Hindsight equivalent. Reapply your own policy before you load.

## What it costs

Retain calls an LLM for each item, so the import costs model calls. On Hindsight Cloud, retain is priced at $10.00 per 1M tokens (vectorize.io/pricing, checked 3 December 2026). Self-hosted Hindsight is free under MIT, and you pay your LLM provider. Add up the total episode text before you start.

## When Hindsight fits

Hindsight's open-source server includes its graph, temporal recall, consolidation and mental models, under MIT. Its strongest lead in our sources is on long histories: 64.1 on BEAM at 10M tokens, against Mem0's 48.6 (figures from Mem0's comparison page). Hindsight's figures are Vectorize-run, so treat them as vendor-reported, not independent.

Hindsight returns more context per retrieval by default, so check your token budget. Set `max_tokens` lower if your prompt is small. For the full comparison, read [Hindsight AI memory](/articles/ai-memory-hindsight/) and [Zep vs Hindsight](/articles/zep-vs-hindsight/).


## FAQ

### Is there an official tool to migrate from Zep to Hindsight?

No. Neither Zep nor Hindsight has an official import tool or migration guide between them, as of 3 December 2026. You list the episodes from each Zep graph with Zep's list episodes API, then load them into Hindsight with batch retain.

### Does Hindsight keep Zep's temporal facts and their validity dates?

Not as Zep stores them. Hindsight's retain step extracts its own facts, times and entities from the text you send. Zep's fact validity intervals are not copied, so check the imported facts with recall before you switch.

### Can I re-run a Zep to Hindsight import without duplicates?

Yes, if you pass the Zep episode uuid as document_id. Sending the same document_id again replaces that document, so a second run does not add copies.

