The soul ecosystem for LangChain: persistent memory, identity, database schema intelligence, and SoulMate API integration.
Project description
langchain-soul ๐ง
The soul ecosystem for LangChain.
One package, full stack:
- Persistent Memory โ Markdown-native, git-versionable, human-readable
- Hybrid Retrieval โ RAG + RLM via soul-agent
- Database Intelligence โ Auto-generated semantic layers via soul-schema
- Managed Cloud Option โ SoulMate handles memory infrastructure for you
Choose Your Setup
| Setup | Best For | Storage |
|---|---|---|
| Local (default) | Development, git-tracked projects | SOUL.md + MEMORY.md files |
| SoulMate (managed) | Production, teams, zero-infra | Cloud API (we handle it) |
Both use the same soul-agent RAG+RLM under the hood.
Install
pip install langchain-soul
This automatically installs:
soul-agentโ Hybrid RAG+RLM memorysoul-schemaโ Database semantic layer generator
Quick Start
Basic Memory
from langchain_soul import SoulMemory
from langchain.chains import ConversationChain
from langchain_openai import ChatOpenAI
# Create markdown-based memory with full RAG+RLM
memory = SoulMemory()
# Use it with your chain
chain = ConversationChain(llm=ChatOpenAI(), memory=memory)
response = chain.predict(input="Hello!")
Your conversations are stored in MEMORY.md โ human-readable, git-versionable, no database required.
With RunnableWithMessageHistory
from langchain_soul import SoulChatMessageHistory
from langchain_core.runnables.history import RunnableWithMessageHistory
chain_with_history = RunnableWithMessageHistory(
chain,
lambda session_id: SoulChatMessageHistory(
memory_path=f"memory/{session_id}.md"
),
)
Semantic Search
# Search past conversations
results = memory.recall("What did we discuss about databases?")
for result in results:
print(f"[{result['score']:.2f}] {result['content']}")
Database Schema Intelligence
Give your agents understanding of database structure:
from langchain_soul import SchemaMemory
# Connect to any SQLAlchemy-compatible database
schema = SchemaMemory("postgresql://user:pass@host/db")
# Auto-generate semantic descriptions using LLM
schema.generate()
# Get context for natural language queries
context = schema.context_for("Show me revenue by region")
SoulMate: Managed Memory (Recommended for Production)
Don't want to manage files? SoulMate is the managed version โ same RAG+RLM, zero infrastructure:
from langchain_soul import SoulMateMemory
from langchain.chains import ConversationChain
from langchain_openai import ChatOpenAI
# Connect to SoulMate cloud
memory = SoulMateMemory(api_key="your-key")
chain = ConversationChain(llm=ChatOpenAI(), memory=memory)
# Same interface, managed infrastructure
response = chain.predict(input="Hello!")
Factory Function
from langchain_soul import create_memory
# Local file-based (default)
memory = create_memory()
# SoulMate managed
memory = create_memory("soulmate", api_key="...")
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ langchain-soul โ
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โ
โ โ SoulMemory โ โSoulMateMemory โ โ
โ โ (local) โ โ (managed) โ โ
โ โโโโโโโโฌโโโโโโโ โโโโโโโโโฌโโโโโโโโ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ soul-agent (RAG + RLM) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ soul-schema โ โ SoulMate API โ โ
โ โ (db intelligence)โ โ (managed memory) โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Part of the Soul Ecosystem
- soul-agent โ Core RAG + RLM library
- soul-schema โ Database semantic layer generator
- crewai-soul โ CrewAI integration
- langchain-soul โ LangChain integration (this package)
- llamaindex-soul โ LlamaIndex integration
- SoulMate โ Managed cloud service
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.1.tar.gz.
File metadata
- Download URL: langchain_soul-0.1.1.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5afb89ae5383f745774221852081d29b835f4726e5a08e1cc5ca77ab56509743
|
|
| MD5 |
98f0bb980400a7e72ebabb47e367b081
|
|
| BLAKE2b-256 |
7de89293aa6fd954c72c11bf9839b2a074b6b5985d6ecc59f57cb180aaa2da45
|
File details
Details for the file langchain_soul-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_soul-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.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 |
5c1bd1d8784c056e90198ccb77e4def7649ea70c8529ad5eb536b55aa2426ab7
|
|
| MD5 |
b34e35bdc6c0c3df67b7cb000e7a00bc
|
|
| BLAKE2b-256 |
4e5b299cf285ee63ff27838dec0f497da244bedba103497b23b187cf996ff518
|