langchain-mesh-cognition
Give any LangChain agent distributed memory across devices. What one agent learns, all agents can recall.
Install
pip install langchain-mesh-cognition
Prerequisite: the mesh service must be running on each device:
npm install -g mesh-cognition-service
mesh-cognition start --daemon
Quick Start
Use tools directly (no LLM needed)
The tools work standalone — no API keys, no LLM costs:
from langchain_mesh_cognition import MeshMemoryWrite, MeshMemorySearch
# Write a memory — broadcasts to all mesh peers
MeshMemoryWrite().invoke({"content": "Team standup moved to 10am Monday", "tags": "meeting,standup"})
# Search from any device on the mesh
print(MeshMemorySearch().invoke({"query": "standup"}))
# → [Hongweis-MacBook-Air.local] Team standup moved to 10am Monday (tags: meeting, standup)
Use with a LangChain agent (optional)
Add mesh memory to a conversational agent that decides when to read/write:
from langchain_mesh_cognition import MeshCognitionToolkit
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
agent = create_react_agent(ChatOpenAI(model="gpt-4o"), MeshCognitionToolkit().get_tools())
agent.invoke({"messages": [("user", "What meetings do I have?")]})
# → Agent calls mesh_memory_search, finds meetings stored by any device on the mesh
Tools
| Tool | Description |
|---|---|
mesh_memory_write |
Store a memory and broadcast to all mesh peers |
mesh_memory_search |
Search memories across all devices on the mesh |
mesh_status |
Check mesh health — peer count, Kuramoto r(t), uptime |
mesh_context |
Get context from aligned peers for enriched reasoning |
Use Individual Tools
from langchain_mesh_cognition import MeshMemoryWrite, MeshMemorySearch
# Add specific tools to any agent
tools = [MeshMemoryWrite(), MeshMemorySearch()]
Custom Service URL
toolkit = MeshCognitionToolkit(base_url="http://192.168.1.100:18790")
Multi-Agent with LangGraph
from langchain_mesh_cognition import MeshCognitionToolkit
from langgraph.prebuilt import create_react_agent
# Two agents sharing the same mesh
research_agent = create_react_agent(llm, MeshCognitionToolkit().get_tools())
writing_agent = create_react_agent(llm, MeshCognitionToolkit().get_tools())
# Research agent stores findings → writing agent recalls them
research_agent.invoke({"messages": [("user", "Research quantum computing trends")]})
writing_agent.invoke({"messages": [("user", "Write a summary using mesh memory")]})
For cross-device mesh, start mesh-cognition on each machine. Agents on different devices share memory automatically via Bonjour/mDNS discovery.
How It Works
LangChain Agent
↓ uses tools
MeshCognitionToolkit
↓ HTTP calls
mesh-cognition-service (localhost:18790)
↓ TCP + Bonjour
Other mesh nodes on the network
The agent doesn't need to know about networking, discovery, or coupling. It just reads and writes memories — the mesh handles distribution.
Links
SYM.BOT Ltd · Apache 2.0
Metadata
Release files for langchain-mesh-cognition 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_mesh_cognition-0.1.0.tar.gz | 6.2 kB | Without provenance | Details for langchain_mesh_cognition-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_mesh_cognition-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_mesh_cognition-0.1.0-py3-none-any.whl |
Total release size: 13.4 kB
Release files / langchain_mesh_cognition-0.1.0.tar.gz
| Download URL | langchain_mesh_cognition-0.1.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77b83092ea270a6d2fd5a523665c0d0a3164e60a89d557b93f58bcc4579ae6b9
|
|
BLAKE2b-256 checksum How to use checksums |
762bc071fa4e5e86c433c6153d2d082ecf90b1755fb55affe8d8256393e8f3a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / langchain_mesh_cognition-0.1.0-py3-none-any.whl
| Download URL | langchain_mesh_cognition-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3bdefd54a1eff9fb73d68ffc290c29efb28977f74d0782cc33094ce12a46bf07
|
|
BLAKE2b-256 checksum How to use checksums |
8cb123ac7fa16f9c39e8032327a5a38bd3c7e951446758e38f29e1da154f10ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for langchain-mesh-cognition 0.1.0
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.