Skip to main content

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 memory
  • soul-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"
    ),
)
# 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")

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

License

MIT

Metadata

Release files for langchain-soul 0.1.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 langchain-soul 0.1.1
File Size Uploaded Provenance
langchain_soul-0.1.1.tar.gz 13.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-soul 0.1.1
File Interpreter ABI Platform
langchain_soul-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / langchain_soul-0.1.1.tar.gz

Download URL langchain_soul-0.1.1.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5afb89ae5383f745774221852081d29b835f4726e5a08e1cc5ca77ab56509743
BLAKE2b-256 checksum
How to use checksums
7de89293aa6fd954c72c11bf9839b2a074b6b5985d6ecc59f57cb180aaa2da45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / langchain_soul-0.1.1-py3-none-any.whl

Download URL langchain_soul-0.1.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c1bd1d8784c056e90198ccb77e4def7649ea70c8529ad5eb536b55aa2426ab7
BLAKE2b-256 checksum
How to use checksums
4e5b299cf285ee63ff27838dec0f497da244bedba103497b23b187cf996ff518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for langchain-soul 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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