Poison-resistant, Byzantine-fault-tolerant shared chat memory for LangChain agent swarms — one prompt-injected agent can't corrupt the shared history.
Project description
memora-langchain
Poison-resistant, Byzantine-fault-tolerant shared chat memory for LangChain agent swarms.
When several LangChain agents share one conversation memory, that memory is the weakest link — one
prompt-injected or malfunctioning agent can overwrite what every other agent then reads. memora-langchain
backs LangChain's message history with Memora, a CRDT + Byzantine-
tolerant shared store: concurrent writers merge without losing turns, and no single agent can silently
rewrite the shared history.
pip install memora-langchain
That's it — this pulls in the memora-swarm engine and langchain-core for you. Get a free API key
(25,000 ops free) at memora.optitransfer.ch/dashboard.
Quickstart
from memora_langchain import MemoraChatMessageHistory
history = MemoraChatMessageHistory(
"support-crew", # room: every agent using this room shares one history
api_key="opti_sk_...",
node_id="triage-agent", # unique per agent
)
history.add_user_message("customer can't log in")
history.add_ai_message("checking their account status…")
for m in history.messages: # merged view across the whole swarm
print(type(m).__name__, m.content)
Use it with RunnableWithMessageHistory
from langchain_core.runnables.history import RunnableWithMessageHistory
chain_with_memory = RunnableWithMessageHistory(
your_chain,
lambda session_id: MemoraChatMessageHistory(session_id, api_key="opti_sk_...", node_id="agent"),
input_messages_key="input",
history_messages_key="history",
)
MemoraChatMessageHistory is a standard langchain_core.chat_history.BaseChatMessageHistory, so it works
anywhere LangChain accepts a chat history — including as the shared store behind a LangGraph node.
Why it's safe under a swarm
- No lost turns. The history is stored as uniquely-tagged message elements and every replica's view is unioned on read, so two agents writing at once can't clobber each other — both sets of turns survive.
- No silent rewrite. Every write is signed and attributable to a node in the underlying Memora engine; a rogue agent's contribution is convicted/evicted rather than trusted on faith.
- Durable + replayable. State survives restarts via a local append-only log.
Pricing
The first 25,000 ops are free (unlimited agents). After that it's metered per semantic op — see memora.optitransfer.ch. Reads and keepalive are never billed.
Links
- Engine & docs — https://memora.optitransfer.ch
- Source & other integrations — https://github.com/mgillr/memora-swarm
- Core package —
memora-swarm
Apache-2.0 · a product of optitransfer.ch
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memora_langchain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memora_langchain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebcb553b1d38a8993bf3a3e8451d7273cf5ee543bb583458db49393cf9dce272
|
|
| MD5 |
94a5175a0c3323feb348c5327a9f7561
|
|
| BLAKE2b-256 |
5ac53c34c16548a83415f5c3bc9dd4ab1b92f3a96473a94efebb4c925dfd0c91
|