Skip to main content

perseus-vault-haystack

Local-first, encrypted persistent memory for Haystack 2.x pipelines, backed by Perseus Vault.

Perseus Vault is an open-source (MIT) memory engine that runs entirely on your machine, stores data in an encrypted SQLite database, and exposes persistent-memory tools over the Model Context Protocol (MCP). This package wraps Perseus Vault as Haystack pipeline components and ready-made Agent tools, so your pipelines and agents can persist and retrieve memory across runs — no external vector database, no cloud, and no API key required.

Why Perseus Vault vs. other Haystack memory stores? It is the only one that runs fully local and offline, stores everything encrypted at rest (AES-256-GCM), needs no API key or signup, and ships as a single binary with no external vector database. Your data never leaves the machine.

What's included

Class / function Type Role
PerseusVaultMemoryStore Memory store Owns the perseus-vault subprocess and config. add_memories / search_memories / delete_all_memories for Documents, plus write_messages / recall_messages for ChatMessages.
PerseusVaultMemoryWriter @component Pipeline sink that persists Documents into the store.
PerseusVaultMemoryRetriever @component Pipeline source that retrieves the most relevant Documents for a query.
create_perseus_vault_tools(...) Agent tools Returns retain_memory / recall_memory / reflect_memory Tools so an Agent decides when to store and retrieve memory.
PerseusVaultMemoryWrapper Agent wrapper Automatic recall-before / retain-after memory for an agent, no tool-calling required.

Prerequisite: the perseus-vault binary

These components talk to a local perseus-vault executable over stdio. Install it first:

  1. Download a pre-built binary from the Perseus Vault releases page (or build from source).
  2. Put it on your $PATH (so perseus-vault resolves), or pass its absolute path via perseus_vault_binary=.

You can verify it works with:

perseus-vault --version

Install

pip install perseus-vault-haystack

This pulls in haystack-ai. The perseus-vault binary is a separate, language-agnostic dependency (see above).

Quickstart — write then read in a pipeline

from haystack import Pipeline, Document
from perseus_vault_haystack import (
    PerseusVaultMemoryStore,
    PerseusVaultMemoryWriter,
    PerseusVaultMemoryRetriever,
)

# One store, shared by both components (single perseus-vault subprocess).
store = PerseusVaultMemoryStore(db_path="~/.perseus-vault/haystack.db", category="docs")

# --- Write documents into persistent memory ---
write_pipe = Pipeline()
write_pipe.add_component("writer", PerseusVaultMemoryWriter(memory_store=store))
write_pipe.run(
    {
        "writer": {
            "documents": [
                Document(content="Perseus Vault is a local-first, encrypted memory engine."),
                Document(content="Haystack is an open-source LLM framework by deepset."),
            ]
        }
    }
)

# --- Retrieve them later (even in a separate process / run) ---
read_pipe = Pipeline()
read_pipe.add_component("retriever", PerseusVaultMemoryRetriever(memory_store=store, top_k=3))
result = read_pipe.run({"retriever": {"query": "What is Perseus Vault?"}})

for doc in result["retriever"]["documents"]:
    print(doc.score, doc.content)

Because Perseus Vault persists to an encrypted SQLite file, documents written in one run are available in any future run pointed at the same db_path.

Use directly (without a pipeline)

from haystack import Document
from perseus_vault_haystack import PerseusVaultMemoryStore

store = PerseusVaultMemoryStore(db_path="~/.perseus-vault/haystack.db")
store.add_memories([Document(content="Remember this fact.")])
hits = store.search_memories("fact", top_k=5)

Agents

Give an Agent memory tools

Let the agent decide when to store and retrieve memory with ready-made Tools:

from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from perseus_vault_haystack import PerseusVaultMemoryStore, create_perseus_vault_tools

store = PerseusVaultMemoryStore(db_path="~/.perseus-vault/agent.db", category="agent-memory")
tools = create_perseus_vault_tools(store)  # retain_memory, recall_memory, reflect_memory

agent = Agent(
    chat_generator=OpenAIChatGenerator(model="gpt-4o-mini"),
    tools=tools,
    system_prompt=(
        "You are a helpful assistant with long-term memory. "
        "Use recall_memory before answering, and retain_memory to store durable facts."
    ),
)

agent.run(messages=[ChatMessage.from_user("Remember that I prefer concise answers.")])

You can include or exclude any tool, e.g. create_perseus_vault_tools(store, include_reflect=False).

Automatic memory (no tool-calling)

PerseusVaultMemoryWrapper injects relevant memories before each turn and stores the exchange after — without relying on the model to call tools:

from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from perseus_vault_haystack import PerseusVaultMemoryStore, PerseusVaultMemoryWrapper

store = PerseusVaultMemoryStore(db_path="~/.perseus-vault/agent.db")
memory = PerseusVaultMemoryWrapper(store, auto_recall=True, auto_retain=True)

agent = Agent(
    chat_generator=OpenAIChatGenerator(model="gpt-4o-mini"),
    system_prompt="You are a helpful assistant with long-term memory.",
)

result = memory.run(agent, messages=[ChatMessage.from_user("I prefer dark mode.")])
print(result["last_message"].text)

ChatMessage memory is also available directly on the store via store.write_messages([...]) and store.recall_messages(query).

Configuration

PerseusVaultMemoryStore accepts:

  • db_path — path to the Perseus Vault SQLite database (default ~/.perseus-vault/haystack.db).
  • perseus_vault_binary — name on $PATH or absolute path to the executable (default perseus-vault).
  • category — Perseus Vault category scoping all writes/recalls for this store (default haystack-memory). Use distinct categories to isolate corpora.
  • top_k — default number of documents returned by retrieval (default 10).
  • timeout_s — per-RPC timeout for the subprocess (default 30).

Serialization

All three classes implement to_dict() / from_dict() and round-trip through Pipeline.dumps() / Pipeline.loads().

License

MIT © 2026 Perseus Computing LLC. Perseus Vault is also MIT-licensed.

Metadata

Release files for perseus-vault-haystack 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perseus-vault-haystack 0.2.1
File Size Uploaded
perseus_vault_haystack-0.2.1.tar.gz 17.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for perseus-vault-haystack 0.2.1
File Interpreter ABI Platform
perseus_vault_haystack-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.9 kB

Release files / perseus_vault_haystack-0.2.1.tar.gz

Download URL perseus_vault_haystack-0.2.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8c45a7962cc70ae7a379bcef8988926ee592aa34c75b7cf5ade3465d5d274a3f
BLAKE2b-256 checksum
How to use checksums
b3ed5d2d043fdb3e0bec6b51b90efd8cc1197e5eb7041f6398222468c30af388
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 1, 2026.

Transparency log

Release files / perseus_vault_haystack-0.2.1-py3-none-any.whl

Download URL perseus_vault_haystack-0.2.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebee7184fc54b156f1c1c63d308245f448c398bb36eb31d43d9995e3c8e3791c
BLAKE2b-256 checksum
How to use checksums
2a6d6109912071f8fb1fa7ff047d153965676f81eb8edfe8613565c2436bf842
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page