Skip to main content

langchain-synapse

An integration package connecting Synapse memory and LangChain.

Privacy-first AI memory — all data stays local. Zero API calls for storage. Zero external dependencies beyond LangChain and Synapse.

Installation

pip install langchain-synapse

Components

SynapseMemory

Drop-in BaseMemory implementation for any LangChain chain:

from langchain_synapse import SynapseMemory
from synapse import Synapse

syn = Synapse("./agent_memory")
memory = SynapseMemory(synapse=syn)

# Use with any chain
chain = prompt | llm
chain.invoke({"input": "hello"}, config={"memory": memory})

SynapseChatMessageHistory

Persistent chat history with semantic recall:

from langchain_synapse import SynapseChatMessageHistory
from synapse import Synapse

syn = Synapse("./chat_memory")
history = SynapseChatMessageHistory(synapse=syn, session_id="user-123")

history.add_user_message("I love Italian food")
history.add_ai_message("Great! Any favorite dish?")

# Semantic search — find relevant messages, not just recent ones
relevant = history.search("What cuisine do they prefer?")

SynapseRetriever

Use Synapse as a retriever in RAG pipelines:

from langchain_synapse import SynapseRetriever
from synapse import Synapse

syn = Synapse("./knowledge_base")
syn.remember("Python was created by Guido van Rossum")
syn.remember("Rust was created by Graydon Hoare at Mozilla")

retriever = SynapseRetriever(synapse=syn, k=5)

# Use in a RAG chain
from langchain_core.runnables import RunnablePassthrough
chain = (
    {"context": retriever, "question": RunnablePassthrough()}
    | prompt
    | llm
)

Why Synapse?

  • 🔒 Privacy-first: All memory stays on your machine. No cloud. No API calls for storage.
  • 🧠 Neuroscience-inspired: Memory strengthening, decay, and semantic recall — not just vector similarity.
  • ⚡ Zero dependencies: Synapse itself is pure Python with no external dependencies.
  • 📦 Portable: .synapse files can be shared, versioned, and federated across agents.

License

MIT

Metadata

Release files for langchain-synapse 0.1.0

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

Source distribution (sdist)

Source distribution for langchain-synapse 0.1.0
File Size Uploaded
langchain_synapse-0.1.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-synapse 0.1.0
File Interpreter ABI Platform
langchain_synapse-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release files / langchain_synapse-0.1.0.tar.gz

Download URL langchain_synapse-0.1.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
68215a5c0c27572d8c3895a9eae8aa7c0ebfc947d7647779ce2c8f75cd8ba638
BLAKE2b-256 checksum
How to use checksums
d412b815a0f90cd578173f765982fd2f2c3d08c97a1bedfd3d0d5e1e17dc970f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / langchain_synapse-0.1.0-py3-none-any.whl

Download URL langchain_synapse-0.1.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
086fbc3b9ba5178f11fbce70afe0696bcbe203d99da4c2ea50d444a9965c4dc6
BLAKE2b-256 checksum
How to use checksums
ce76fcae2f7439bb2ce49a2f768e8c1d919adab13079c451ffd9e0bf135b8f0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

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