Markdown-native memory for LangChain. Human-readable, git-versionable, powered by soul-agent.
Project description
langchain-soul 🧠
Markdown-native memory for LangChain.
Your conversation history shouldn't be a black box. langchain-soul stores everything in human-readable markdown files:
SOUL.md— Agent identityMEMORY.md— Timestamped conversation log
Human-readable. Git-versionable. Powered by soul-agent.
Install
pip install langchain-soul
Quick Start
from langchain_soul import SoulMemory
from langchain.chains import ConversationChain
from langchain_openai import ChatOpenAI
# Create markdown-based memory
memory = SoulMemory()
# Use with LangChain
chain = ConversationChain(llm=ChatOpenAI(), memory=memory)
response = chain.predict(input="Hello! How are you?")
print(response)
response = chain.predict(input="What did I just say?")
print(response) # Remembers the conversation!
After running, check MEMORY.md:
# Conversation History
## 2026-03-06 19:20:15 UTC
**Human:** Hello! How are you?
**AI:** I'm doing well, thank you for asking! How can I help you today?
## 2026-03-06 19:20:18 UTC
**Human:** What did I just say?
**AI:** You said "Hello! How are you?"
Features
Semantic Search
# Find relevant past conversations
results = memory.recall("What did we discuss about databases?")
for r in results:
print(f"[{r['score']:.2f}] {r['content']}")
Custom Paths
memory = SoulMemory(
soul_path="agents/assistant/SOUL.md",
memory_path="agents/assistant/MEMORY.md",
)
Message Format
# Return as LangChain message objects (for chat models)
memory = SoulMemory(return_messages=True)
Conversation Window
# Only include last 5 exchanges in context
memory = SoulMemory(k=5)
Custom Prefixes
memory = SoulMemory(
human_prefix="User",
ai_prefix="Assistant",
)
API Reference
SoulMemory
SoulMemory(
soul_path="SOUL.md", # Path to agent identity file
memory_path="MEMORY.md", # Path to conversation log
human_prefix="Human", # Prefix for human messages
ai_prefix="AI", # Prefix for AI messages
memory_key="history", # Key for memory in chain
input_key="input", # Key for human input
output_key="output", # Key for AI output
return_messages=False, # Return as Message objects
k=10, # Number of recent exchanges to include
use_hybrid=True, # Use soul-agent RAG+RLM
provider="anthropic", # LLM provider for hybrid retrieval
)
Methods
| Method | Description |
|---|---|
save_context(inputs, outputs) |
Save a conversation exchange |
load_memory_variables(inputs) |
Load memory for chain |
clear() |
Clear all conversation history |
recall(query, limit=5) |
Semantic search over history |
get_buffer_string() |
Get full history as string |
The Soul Ecosystem
| Package | Framework | PyPI |
|---|---|---|
| soul-agent | Core library | pip install soul-agent |
| crewai-soul | CrewAI | pip install crewai-soul |
| langchain-soul | LangChain | pip install langchain-soul |
Links
- soul.py — Core memory library
- crewai-soul — CrewAI integration
- The Menon Lab — Research & tools
License
MIT
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 Distribution
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 langchain_soul-0.1.0.tar.gz.
File metadata
- Download URL: langchain_soul-0.1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75b3a79b50a5fc220465ffbbd22cc939fc5f720519d0dda67d5f52a75df096c7
|
|
| MD5 |
1d7f6686a2992ac28f8a6727bb363685
|
|
| BLAKE2b-256 |
e17b377c0e21d692889dafcacfce7c51e7469a78d4bc0581db5552963d2236c0
|
File details
Details for the file langchain_soul-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_soul-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f98c99b768ea7e7a2884f3e6436cd549407ee431b9df8661b589049e90d45b4
|
|
| MD5 |
be4827a1aa1b7910ef37612c307e3703
|
|
| BLAKE2b-256 |
cd2cc2eb7cbf7e4a10332f88db80db36cd2c7314eeb61067d44b9d4ee4de7e9c
|