mcal-ai-langgraph 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcal_ai_langgraph-0.2.0/LICENSE +21 -0
- mcal_ai_langgraph-0.2.0/PKG-INFO +147 -0
- mcal_ai_langgraph-0.2.0/README.md +116 -0
- mcal_ai_langgraph-0.2.0/pyproject.toml +50 -0
- mcal_ai_langgraph-0.2.0/setup.cfg +4 -0
- mcal_ai_langgraph-0.2.0/src/mcal_ai_langgraph.egg-info/PKG-INFO +147 -0
- mcal_ai_langgraph-0.2.0/src/mcal_ai_langgraph.egg-info/SOURCES.txt +16 -0
- mcal_ai_langgraph-0.2.0/src/mcal_ai_langgraph.egg-info/dependency_links.txt +1 -0
- mcal_ai_langgraph-0.2.0/src/mcal_ai_langgraph.egg-info/requires.txt +8 -0
- mcal_ai_langgraph-0.2.0/src/mcal_ai_langgraph.egg-info/top_level.txt +1 -0
- mcal_ai_langgraph-0.2.0/src/mcal_langgraph/__init__.py +39 -0
- mcal_ai_langgraph-0.2.0/src/mcal_langgraph/_compat.py +71 -0
- mcal_ai_langgraph-0.2.0/src/mcal_langgraph/checkpointer.py +53 -0
- mcal_ai_langgraph-0.2.0/src/mcal_langgraph/memory.py +189 -0
- mcal_ai_langgraph-0.2.0/src/mcal_langgraph/py.typed +1 -0
- mcal_ai_langgraph-0.2.0/src/mcal_langgraph/store.py +564 -0
- mcal_ai_langgraph-0.2.0/tests/test_integration.py +40 -0
- mcal_ai_langgraph-0.2.0/tests/test_store.py +458 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shiva
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcal-ai-langgraph
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: LangGraph integration for MCAL - Goal-aware memory for AI agents
|
|
5
|
+
Author: MCAL Team
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Shivakoreddi/mcal-ai
|
|
8
|
+
Project-URL: Documentation, https://github.com/Shivakoreddi/mcal-ai/blob/main/docs/integrations/langgraph.md
|
|
9
|
+
Project-URL: Repository, https://github.com/Shivakoreddi/mcal-ai.git
|
|
10
|
+
Project-URL: Issues, https://github.com/Shivakoreddi/mcal-ai/issues
|
|
11
|
+
Keywords: mcal,langgraph,memory,agents,llm,goal-aware,langchain
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mcal-ai>=0.1.0
|
|
24
|
+
Requires-Dist: langgraph>=0.0.40
|
|
25
|
+
Requires-Dist: langchain-core>=0.1.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# mcal-langgraph
|
|
33
|
+
|
|
34
|
+
LangGraph integration for [MCAL](https://github.com/Shivakoreddi/mcla-research) - Goal-aware memory for AI agents.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install mcal-langgraph
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will automatically install `mcal` and `langgraph` as dependencies.
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from mcal import MCAL
|
|
48
|
+
from mcal_langgraph import MCALStore
|
|
49
|
+
|
|
50
|
+
# Initialize MCAL with a goal
|
|
51
|
+
mcal = MCAL(goal="Build a fraud detection system")
|
|
52
|
+
|
|
53
|
+
# Create LangGraph-compatible store
|
|
54
|
+
store = MCALStore(mcal)
|
|
55
|
+
|
|
56
|
+
# Use with LangGraph
|
|
57
|
+
from langgraph.prebuilt import create_react_agent
|
|
58
|
+
|
|
59
|
+
agent = create_react_agent(
|
|
60
|
+
model=your_model,
|
|
61
|
+
tools=your_tools,
|
|
62
|
+
store=store # Goal-aware memory!
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
### MCALStore (BaseStore)
|
|
69
|
+
|
|
70
|
+
Drop-in replacement for LangGraph's built-in stores with **goal-aware** memory:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from mcal_langgraph import MCALStore
|
|
74
|
+
|
|
75
|
+
store = MCALStore(mcal)
|
|
76
|
+
|
|
77
|
+
# Store memories
|
|
78
|
+
await store.aput(
|
|
79
|
+
namespace=("user_123", "memories"),
|
|
80
|
+
key="decision_1",
|
|
81
|
+
value={"text": "Decided to use PostgreSQL for ACID compliance"}
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# Goal-aware search - returns memories relevant to current goals
|
|
85
|
+
results = await store.asearch(
|
|
86
|
+
namespace_prefix=("user_123",),
|
|
87
|
+
query="database choice"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Results include goal context and decisions
|
|
91
|
+
for item in results:
|
|
92
|
+
print(item.value["goals"]) # Related goals
|
|
93
|
+
print(item.value["decisions"]) # Related decisions
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### MCALMemory
|
|
97
|
+
|
|
98
|
+
Memory nodes for custom LangGraph workflows:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from mcal_langgraph import MCALMemory
|
|
102
|
+
|
|
103
|
+
memory = MCALMemory(llm_provider="anthropic")
|
|
104
|
+
|
|
105
|
+
# Add as nodes in your graph
|
|
106
|
+
graph.add_node("update_memory", memory.update_node())
|
|
107
|
+
graph.add_node("get_context", memory.context_node())
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### MCALCheckpointer
|
|
111
|
+
|
|
112
|
+
State persistence for LangGraph graphs:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from mcal_langgraph import MCALCheckpointer
|
|
116
|
+
|
|
117
|
+
checkpointer = MCALCheckpointer(mcal)
|
|
118
|
+
graph = builder.compile(checkpointer=checkpointer)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Why mcal-langgraph?
|
|
122
|
+
|
|
123
|
+
| Feature | LangGraph InMemoryStore | **MCALStore** |
|
|
124
|
+
|---------|------------------------|---------------|
|
|
125
|
+
| BaseStore interface | ✅ | ✅ |
|
|
126
|
+
| Namespace organization | ✅ | ✅ |
|
|
127
|
+
| **Goal-aware search** | ❌ | ✅ |
|
|
128
|
+
| **Decision tracking** | ❌ | ✅ |
|
|
129
|
+
| **Intent preservation** | ❌ | ✅ |
|
|
130
|
+
|
|
131
|
+
## Migrating from mcal[langgraph]
|
|
132
|
+
|
|
133
|
+
If you were using the old extras-based installation:
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
# Old way (deprecated)
|
|
137
|
+
from mcal.integrations.langgraph import MCALStore
|
|
138
|
+
|
|
139
|
+
# New way (recommended)
|
|
140
|
+
from mcal_langgraph import MCALStore
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The old import path still works but will show a deprecation warning.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# mcal-langgraph
|
|
2
|
+
|
|
3
|
+
LangGraph integration for [MCAL](https://github.com/Shivakoreddi/mcla-research) - Goal-aware memory for AI agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install mcal-langgraph
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will automatically install `mcal` and `langgraph` as dependencies.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from mcal import MCAL
|
|
17
|
+
from mcal_langgraph import MCALStore
|
|
18
|
+
|
|
19
|
+
# Initialize MCAL with a goal
|
|
20
|
+
mcal = MCAL(goal="Build a fraud detection system")
|
|
21
|
+
|
|
22
|
+
# Create LangGraph-compatible store
|
|
23
|
+
store = MCALStore(mcal)
|
|
24
|
+
|
|
25
|
+
# Use with LangGraph
|
|
26
|
+
from langgraph.prebuilt import create_react_agent
|
|
27
|
+
|
|
28
|
+
agent = create_react_agent(
|
|
29
|
+
model=your_model,
|
|
30
|
+
tools=your_tools,
|
|
31
|
+
store=store # Goal-aware memory!
|
|
32
|
+
)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
### MCALStore (BaseStore)
|
|
38
|
+
|
|
39
|
+
Drop-in replacement for LangGraph's built-in stores with **goal-aware** memory:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from mcal_langgraph import MCALStore
|
|
43
|
+
|
|
44
|
+
store = MCALStore(mcal)
|
|
45
|
+
|
|
46
|
+
# Store memories
|
|
47
|
+
await store.aput(
|
|
48
|
+
namespace=("user_123", "memories"),
|
|
49
|
+
key="decision_1",
|
|
50
|
+
value={"text": "Decided to use PostgreSQL for ACID compliance"}
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Goal-aware search - returns memories relevant to current goals
|
|
54
|
+
results = await store.asearch(
|
|
55
|
+
namespace_prefix=("user_123",),
|
|
56
|
+
query="database choice"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Results include goal context and decisions
|
|
60
|
+
for item in results:
|
|
61
|
+
print(item.value["goals"]) # Related goals
|
|
62
|
+
print(item.value["decisions"]) # Related decisions
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### MCALMemory
|
|
66
|
+
|
|
67
|
+
Memory nodes for custom LangGraph workflows:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from mcal_langgraph import MCALMemory
|
|
71
|
+
|
|
72
|
+
memory = MCALMemory(llm_provider="anthropic")
|
|
73
|
+
|
|
74
|
+
# Add as nodes in your graph
|
|
75
|
+
graph.add_node("update_memory", memory.update_node())
|
|
76
|
+
graph.add_node("get_context", memory.context_node())
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### MCALCheckpointer
|
|
80
|
+
|
|
81
|
+
State persistence for LangGraph graphs:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from mcal_langgraph import MCALCheckpointer
|
|
85
|
+
|
|
86
|
+
checkpointer = MCALCheckpointer(mcal)
|
|
87
|
+
graph = builder.compile(checkpointer=checkpointer)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Why mcal-langgraph?
|
|
91
|
+
|
|
92
|
+
| Feature | LangGraph InMemoryStore | **MCALStore** |
|
|
93
|
+
|---------|------------------------|---------------|
|
|
94
|
+
| BaseStore interface | ✅ | ✅ |
|
|
95
|
+
| Namespace organization | ✅ | ✅ |
|
|
96
|
+
| **Goal-aware search** | ❌ | ✅ |
|
|
97
|
+
| **Decision tracking** | ❌ | ✅ |
|
|
98
|
+
| **Intent preservation** | ❌ | ✅ |
|
|
99
|
+
|
|
100
|
+
## Migrating from mcal[langgraph]
|
|
101
|
+
|
|
102
|
+
If you were using the old extras-based installation:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
# Old way (deprecated)
|
|
106
|
+
from mcal.integrations.langgraph import MCALStore
|
|
107
|
+
|
|
108
|
+
# New way (recommended)
|
|
109
|
+
from mcal_langgraph import MCALStore
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The old import path still works but will show a deprecation warning.
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mcal-ai-langgraph"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "LangGraph integration for MCAL - Goal-aware memory for AI agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "MCAL Team"}
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.11"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
24
|
+
]
|
|
25
|
+
keywords = ["mcal", "langgraph", "memory", "agents", "llm", "goal-aware", "langchain"]
|
|
26
|
+
|
|
27
|
+
dependencies = [
|
|
28
|
+
"mcal-ai>=0.1.0",
|
|
29
|
+
"langgraph>=0.0.40",
|
|
30
|
+
"langchain-core>=0.1.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"pytest>=7.4.0",
|
|
36
|
+
"pytest-asyncio>=0.21.0",
|
|
37
|
+
"pytest-cov>=4.0.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/Shivakoreddi/mcal-ai"
|
|
42
|
+
Documentation = "https://github.com/Shivakoreddi/mcal-ai/blob/main/docs/integrations/langgraph.md"
|
|
43
|
+
Repository = "https://github.com/Shivakoreddi/mcal-ai.git"
|
|
44
|
+
Issues = "https://github.com/Shivakoreddi/mcal-ai/issues"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["src"]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.package-data]
|
|
50
|
+
mcal_langgraph = ["py.typed"]
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcal-ai-langgraph
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: LangGraph integration for MCAL - Goal-aware memory for AI agents
|
|
5
|
+
Author: MCAL Team
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Shivakoreddi/mcal-ai
|
|
8
|
+
Project-URL: Documentation, https://github.com/Shivakoreddi/mcal-ai/blob/main/docs/integrations/langgraph.md
|
|
9
|
+
Project-URL: Repository, https://github.com/Shivakoreddi/mcal-ai.git
|
|
10
|
+
Project-URL: Issues, https://github.com/Shivakoreddi/mcal-ai/issues
|
|
11
|
+
Keywords: mcal,langgraph,memory,agents,llm,goal-aware,langchain
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mcal-ai>=0.1.0
|
|
24
|
+
Requires-Dist: langgraph>=0.0.40
|
|
25
|
+
Requires-Dist: langchain-core>=0.1.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# mcal-langgraph
|
|
33
|
+
|
|
34
|
+
LangGraph integration for [MCAL](https://github.com/Shivakoreddi/mcla-research) - Goal-aware memory for AI agents.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install mcal-langgraph
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will automatically install `mcal` and `langgraph` as dependencies.
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from mcal import MCAL
|
|
48
|
+
from mcal_langgraph import MCALStore
|
|
49
|
+
|
|
50
|
+
# Initialize MCAL with a goal
|
|
51
|
+
mcal = MCAL(goal="Build a fraud detection system")
|
|
52
|
+
|
|
53
|
+
# Create LangGraph-compatible store
|
|
54
|
+
store = MCALStore(mcal)
|
|
55
|
+
|
|
56
|
+
# Use with LangGraph
|
|
57
|
+
from langgraph.prebuilt import create_react_agent
|
|
58
|
+
|
|
59
|
+
agent = create_react_agent(
|
|
60
|
+
model=your_model,
|
|
61
|
+
tools=your_tools,
|
|
62
|
+
store=store # Goal-aware memory!
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
### MCALStore (BaseStore)
|
|
69
|
+
|
|
70
|
+
Drop-in replacement for LangGraph's built-in stores with **goal-aware** memory:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from mcal_langgraph import MCALStore
|
|
74
|
+
|
|
75
|
+
store = MCALStore(mcal)
|
|
76
|
+
|
|
77
|
+
# Store memories
|
|
78
|
+
await store.aput(
|
|
79
|
+
namespace=("user_123", "memories"),
|
|
80
|
+
key="decision_1",
|
|
81
|
+
value={"text": "Decided to use PostgreSQL for ACID compliance"}
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# Goal-aware search - returns memories relevant to current goals
|
|
85
|
+
results = await store.asearch(
|
|
86
|
+
namespace_prefix=("user_123",),
|
|
87
|
+
query="database choice"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Results include goal context and decisions
|
|
91
|
+
for item in results:
|
|
92
|
+
print(item.value["goals"]) # Related goals
|
|
93
|
+
print(item.value["decisions"]) # Related decisions
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### MCALMemory
|
|
97
|
+
|
|
98
|
+
Memory nodes for custom LangGraph workflows:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from mcal_langgraph import MCALMemory
|
|
102
|
+
|
|
103
|
+
memory = MCALMemory(llm_provider="anthropic")
|
|
104
|
+
|
|
105
|
+
# Add as nodes in your graph
|
|
106
|
+
graph.add_node("update_memory", memory.update_node())
|
|
107
|
+
graph.add_node("get_context", memory.context_node())
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### MCALCheckpointer
|
|
111
|
+
|
|
112
|
+
State persistence for LangGraph graphs:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from mcal_langgraph import MCALCheckpointer
|
|
116
|
+
|
|
117
|
+
checkpointer = MCALCheckpointer(mcal)
|
|
118
|
+
graph = builder.compile(checkpointer=checkpointer)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Why mcal-langgraph?
|
|
122
|
+
|
|
123
|
+
| Feature | LangGraph InMemoryStore | **MCALStore** |
|
|
124
|
+
|---------|------------------------|---------------|
|
|
125
|
+
| BaseStore interface | ✅ | ✅ |
|
|
126
|
+
| Namespace organization | ✅ | ✅ |
|
|
127
|
+
| **Goal-aware search** | ❌ | ✅ |
|
|
128
|
+
| **Decision tracking** | ❌ | ✅ |
|
|
129
|
+
| **Intent preservation** | ❌ | ✅ |
|
|
130
|
+
|
|
131
|
+
## Migrating from mcal[langgraph]
|
|
132
|
+
|
|
133
|
+
If you were using the old extras-based installation:
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
# Old way (deprecated)
|
|
137
|
+
from mcal.integrations.langgraph import MCALStore
|
|
138
|
+
|
|
139
|
+
# New way (recommended)
|
|
140
|
+
from mcal_langgraph import MCALStore
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The old import path still works but will show a deprecation warning.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/mcal_ai_langgraph.egg-info/PKG-INFO
|
|
5
|
+
src/mcal_ai_langgraph.egg-info/SOURCES.txt
|
|
6
|
+
src/mcal_ai_langgraph.egg-info/dependency_links.txt
|
|
7
|
+
src/mcal_ai_langgraph.egg-info/requires.txt
|
|
8
|
+
src/mcal_ai_langgraph.egg-info/top_level.txt
|
|
9
|
+
src/mcal_langgraph/__init__.py
|
|
10
|
+
src/mcal_langgraph/_compat.py
|
|
11
|
+
src/mcal_langgraph/checkpointer.py
|
|
12
|
+
src/mcal_langgraph/memory.py
|
|
13
|
+
src/mcal_langgraph/py.typed
|
|
14
|
+
src/mcal_langgraph/store.py
|
|
15
|
+
tests/test_integration.py
|
|
16
|
+
tests/test_store.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mcal_langgraph
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
mcal-langgraph: LangGraph integration for MCAL
|
|
3
|
+
|
|
4
|
+
Provides goal-aware memory for LangGraph agent workflows:
|
|
5
|
+
- MCALStore: BaseStore implementation with goal-aware search
|
|
6
|
+
- MCALMemory: Memory nodes for LangGraph workflows
|
|
7
|
+
- MCALCheckpointer: State persistence for graphs
|
|
8
|
+
|
|
9
|
+
Installation:
|
|
10
|
+
pip install mcal-langgraph
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
from mcal import MCAL
|
|
14
|
+
from mcal_langgraph import MCALStore
|
|
15
|
+
|
|
16
|
+
mcal = MCAL(goal="Build fraud detection system")
|
|
17
|
+
store = MCALStore(mcal)
|
|
18
|
+
|
|
19
|
+
# Use with LangGraph
|
|
20
|
+
from langgraph.prebuilt import create_react_agent
|
|
21
|
+
agent = create_react_agent(model, tools, store=store)
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from mcal_langgraph.store import MCALStore
|
|
25
|
+
from mcal_langgraph.memory import MCALMemory, MCALMemoryConfig
|
|
26
|
+
from mcal_langgraph.checkpointer import MCALCheckpointer
|
|
27
|
+
from mcal_langgraph._compat import LANGGRAPH_AVAILABLE
|
|
28
|
+
|
|
29
|
+
# Version
|
|
30
|
+
__version__ = "0.1.0"
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"MCALStore",
|
|
34
|
+
"MCALMemory",
|
|
35
|
+
"MCALMemoryConfig",
|
|
36
|
+
"MCALCheckpointer",
|
|
37
|
+
"LANGGRAPH_AVAILABLE",
|
|
38
|
+
"__version__",
|
|
39
|
+
]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Compatibility layer for LangGraph imports.
|
|
3
|
+
|
|
4
|
+
Handles graceful degradation when langgraph is not installed.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
# Check for LangGraph availability
|
|
11
|
+
try:
|
|
12
|
+
from langgraph.graph import StateGraph
|
|
13
|
+
from langgraph.checkpoint.base import BaseCheckpointSaver
|
|
14
|
+
from langgraph.store.base import (
|
|
15
|
+
BaseStore,
|
|
16
|
+
Item,
|
|
17
|
+
SearchItem,
|
|
18
|
+
GetOp,
|
|
19
|
+
PutOp,
|
|
20
|
+
SearchOp,
|
|
21
|
+
ListNamespacesOp,
|
|
22
|
+
NamespacePath,
|
|
23
|
+
)
|
|
24
|
+
from langchain_core.messages import BaseMessage, HumanMessage, AIMessage
|
|
25
|
+
|
|
26
|
+
LANGGRAPH_AVAILABLE = True
|
|
27
|
+
except ImportError:
|
|
28
|
+
LANGGRAPH_AVAILABLE = False
|
|
29
|
+
StateGraph = None
|
|
30
|
+
BaseCheckpointSaver = object
|
|
31
|
+
BaseStore = object
|
|
32
|
+
Item = None
|
|
33
|
+
SearchItem = None
|
|
34
|
+
GetOp = None
|
|
35
|
+
PutOp = None
|
|
36
|
+
SearchOp = None
|
|
37
|
+
ListNamespacesOp = None
|
|
38
|
+
NamespacePath = None
|
|
39
|
+
BaseMessage = Any
|
|
40
|
+
HumanMessage = Any
|
|
41
|
+
AIMessage = Any
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def check_langgraph():
|
|
45
|
+
"""Raise helpful error if LangGraph not installed."""
|
|
46
|
+
if not LANGGRAPH_AVAILABLE:
|
|
47
|
+
raise ImportError(
|
|
48
|
+
"mcal-langgraph requires langgraph package.\n"
|
|
49
|
+
"Install with: pip install mcal-langgraph\n"
|
|
50
|
+
"Or manually: pip install langgraph langchain-core"
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# Export everything needed by other modules
|
|
55
|
+
__all__ = [
|
|
56
|
+
"LANGGRAPH_AVAILABLE",
|
|
57
|
+
"check_langgraph",
|
|
58
|
+
"StateGraph",
|
|
59
|
+
"BaseCheckpointSaver",
|
|
60
|
+
"BaseStore",
|
|
61
|
+
"Item",
|
|
62
|
+
"SearchItem",
|
|
63
|
+
"GetOp",
|
|
64
|
+
"PutOp",
|
|
65
|
+
"SearchOp",
|
|
66
|
+
"ListNamespacesOp",
|
|
67
|
+
"NamespacePath",
|
|
68
|
+
"BaseMessage",
|
|
69
|
+
"HumanMessage",
|
|
70
|
+
"AIMessage",
|
|
71
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MCALCheckpointer: State persistence for LangGraph graphs.
|
|
3
|
+
|
|
4
|
+
Stores graph state alongside MCAL memory for unified persistence.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any, Dict, List, Optional
|
|
10
|
+
|
|
11
|
+
from mcal_langgraph._compat import (
|
|
12
|
+
check_langgraph,
|
|
13
|
+
LANGGRAPH_AVAILABLE,
|
|
14
|
+
BaseCheckpointSaver,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class MCALCheckpointer(BaseCheckpointSaver if LANGGRAPH_AVAILABLE else object):
|
|
19
|
+
"""
|
|
20
|
+
MCAL-based checkpointer for LangGraph state persistence.
|
|
21
|
+
|
|
22
|
+
Stores graph state alongside MCAL memory for unified persistence.
|
|
23
|
+
|
|
24
|
+
Usage:
|
|
25
|
+
from mcal_langgraph import MCALCheckpointer
|
|
26
|
+
|
|
27
|
+
checkpointer = MCALCheckpointer(storage_path="~/.mcal")
|
|
28
|
+
graph = StateGraph(...).compile(checkpointer=checkpointer)
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def __init__(self, storage_path: Optional[str] = None):
|
|
32
|
+
check_langgraph()
|
|
33
|
+
if LANGGRAPH_AVAILABLE:
|
|
34
|
+
super().__init__()
|
|
35
|
+
self.storage_path = storage_path
|
|
36
|
+
self._checkpoints: Dict[str, Any] = {}
|
|
37
|
+
|
|
38
|
+
def get(self, config: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
39
|
+
"""Get checkpoint by config."""
|
|
40
|
+
thread_id = config.get("configurable", {}).get("thread_id", "default")
|
|
41
|
+
return self._checkpoints.get(thread_id)
|
|
42
|
+
|
|
43
|
+
def put(self, config: Dict[str, Any], checkpoint: Dict[str, Any]) -> None:
|
|
44
|
+
"""Save checkpoint."""
|
|
45
|
+
thread_id = config.get("configurable", {}).get("thread_id", "default")
|
|
46
|
+
self._checkpoints[thread_id] = checkpoint
|
|
47
|
+
|
|
48
|
+
def list(self, config: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
49
|
+
"""List all checkpoints."""
|
|
50
|
+
return list(self._checkpoints.values())
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
__all__ = ["MCALCheckpointer"]
|