Add your description here
Project description
LangMem0
Environment
- uv >= 0.9
Quickstart
1. Clone the repository
git clone https://github.com/sammyne/langmem0.git
cd langmem0
2. Install dependencies
uv pip install -e .
3. Set up environment variables
Create a .env file in the project root with your OpenAI configuration:
OPENAI_API_KEY=your_api_key_here
OPENAI_API_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o-mini
4. Run examples
LangMem0 provides two main ways to integrate memory into your LangChain applications:
Middleware Examples
Use Mem0Middleware to enable memory in LangChain agent conversations. This approach provides fine-grained control over memory operations.
# Synchronous example
uv run examples/middleware/helloworld.py
# Asynchronous example
uv run examples/middleware/helloworld_async.py
These examples demonstrate:
- Using
Mem0Middlewareto intercept and augment agent messages with memories - How agents can remember and retrieve information across conversations
- Different thread contexts for separate conversation memories
- Integration with LangGraph checkpoints
Chat Examples
Use ChatOpenAI with built-in Mem0 memory capabilities for a simpler integration path.
# Basic synchronous example
uv run examples/chat/helloworld.py
# Basic asynchronous example
uv run examples/chat/helloworld_async.py
# Advanced synchronous with RunnableConfig:**
uv run examples/chat/runnable_config.py
# Advanced asynchronous with RunnableConfig:**
uv run examples/chat/runnable_config_async.py
These examples demonstrate:
- Direct integration with OpenAI-compatible chat models
- Memory-enabled conversations with minimal setup
- Using
RunnableConfigfor thread management - Both sync and async API patterns
FAQ
Why not provide tool-based API like langmem
Tool-based API has a problem: system prompt needs augumenting with memories using a separate middleware as demonstrated by LangMem's Hot Path Quickstart.
References
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 langmem0-0.1.0.tar.gz.
File metadata
- Download URL: langmem0-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
182a2dfee666c1ce363967db13c99aa20d8fd673d739d46c0701b5a86a8942bc
|
|
| MD5 |
b2ba688aa3061768bc4fa4221618315e
|
|
| BLAKE2b-256 |
536925197525aca0f7609c0779fa12271c2e7414346e3a2ea281483293c7ba7a
|
Provenance
The following attestation bundles were made for langmem0-0.1.0.tar.gz:
Publisher:
pypi.yml on sammyne/langmem0
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langmem0-0.1.0.tar.gz -
Subject digest:
182a2dfee666c1ce363967db13c99aa20d8fd673d739d46c0701b5a86a8942bc - Sigstore transparency entry: 813099302
- Sigstore integration time:
-
Permalink:
sammyne/langmem0@c390da6a5698f9d3831c977915a12fa2ce48aa20 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/sammyne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@c390da6a5698f9d3831c977915a12fa2ce48aa20 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langmem0-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langmem0-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b9f1c66e9f712fc56eb994738a217cdfdfa3cb856a23ee06c05d82e7ffddd0f
|
|
| MD5 |
1d92151bf57338f9a65fa1ef0250c271
|
|
| BLAKE2b-256 |
ff19e090301917cc8ab4c2e49915213c4b4b457ef99869a3f05cf7e9e4d9f834
|
Provenance
The following attestation bundles were made for langmem0-0.1.0-py3-none-any.whl:
Publisher:
pypi.yml on sammyne/langmem0
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langmem0-0.1.0-py3-none-any.whl -
Subject digest:
3b9f1c66e9f712fc56eb994738a217cdfdfa3cb856a23ee06c05d82e7ffddd0f - Sigstore transparency entry: 813099303
- Sigstore integration time:
-
Permalink:
sammyne/langmem0@c390da6a5698f9d3831c977915a12fa2ce48aa20 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/sammyne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@c390da6a5698f9d3831c977915a12fa2ce48aa20 -
Trigger Event:
push
-
Statement type: