From Letta (MemGPT)

Import agent memories from Letta (formerly MemGPT) into Mnemosyne. Supports AgentFile (.af) format, SDK export, and REST API.

One Command

Export your agent's memory from Letta as an .af file, then import it offline:

# In Letta: export your agent
letta agent export --agent-id abc123 --output my-agent.af

# Then import into Mnemosyne
hermes mnemosyne import --from letta --agent-file-path ./my-agent.af

Via API

hermes mnemosyne import --from letta --api-key sk-xxx --agent-id abc123

What Gets Imported

Letta stores memories in a hierarchical model. The importer converts each layer:

  • Memory Blocks (core/working memory) → Mnemosyne working memory
  • Archival Memory (long-term vector storage) → episodic memory with source="letta_archival"
  • Message History → episodic memory with source="letta_message"
  • Agent Config & Tools → metadata entries

Options

# Offline AgentFile import (no API key needed)
hermes mnemosyne import --from letta --agent-file-path ./agent.af

# Specific agent via API
hermes mnemosyne import --from letta --api-key sk-xxx --agent-id agent-123

# Self-hosted Letta
hermes mnemosyne import --from letta --api-key sk-xxx --base-url http://localhost:8283

# Dry run
hermes mnemosyne import --from letta --agent-file-path ./agent.af --dry-run

Extraction Methods

The Letta importer tries three methods in order:

  1. Offline AgentFile — Parses a local .af file. No API key or network needed.
  2. Python SDK (pip install letta-client) — Uses client.agents.export_file(agent_id).
  3. REST API — Fetches memory blocks and archival search via HTTP.

If you have the .af file locally, method 1 is the simplest.

SDK Dependencies

pip install letta-client

Or use offline .af file import with no dependencies.

Identity Mapping

Letta SourceMnemosyne Field
Memory block labelcontent
Memory block valuecontent (or metadata if label exists)
agent.nameauthor_id
Archival memory textcontent with source="letta_archival"
Message role + contentcontent with source="letta_message"
created_atPreserved in metadata
Memory block limit / settingsPreserved in metadata

Programmatic Import

from mnemosyne import Mnemosyne
from mnemosyne.core.importers import LettaImporter

mnemosyne = Mnemosyne(session_id="migration")

# Offline .af file
importer = LettaImporter(agent_file_path="./my-agent.af")
result = importer.run(mnemosyne)

# Via API
importer = LettaImporter(api_key="sk-xxx", agent_id="agent-123")
result = importer.run(mnemosyne, dry_run=True)

print(f"Imported {result.imported} of {result.total}")