greennode-agent-bridge 1.0.1__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.
- greennode_agent_bridge-1.0.1/.github/workflows/publish.yml +260 -0
- greennode_agent_bridge-1.0.1/PKG-INFO +115 -0
- greennode_agent_bridge-1.0.1/README.md +87 -0
- greennode_agent_bridge-1.0.1/pyproject.toml +80 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/__init__.py +34 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/langgraph/__init__.py +21 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/langgraph/memory/__init__.py +38 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/langgraph/memory/constants.py +27 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/langgraph/memory/events.py +349 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/langgraph/memory/helpers.py +664 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/langgraph/memory/models.py +100 -0
- greennode_agent_bridge-1.0.1/src/greennode_agent_bridge/langgraph/memory/records.py +482 -0
- greennode_agent_bridge-1.0.1/uv.lock +1573 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
name: Publish Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- dev
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- '**.md'
|
|
10
|
+
- '.gitignore'
|
|
11
|
+
tags:
|
|
12
|
+
- 'v*'
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
publish-dev:
|
|
17
|
+
name: Publish Dev Version to TestPyPI
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
id-token: write
|
|
21
|
+
contents: read
|
|
22
|
+
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
|
|
23
|
+
environment:
|
|
24
|
+
name: testpypi
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout code
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Install uv
|
|
31
|
+
uses: astral-sh/setup-uv@v4
|
|
32
|
+
with:
|
|
33
|
+
version: "latest"
|
|
34
|
+
|
|
35
|
+
- name: Set up Python and install dependencies
|
|
36
|
+
run: uv sync --group dev --group build
|
|
37
|
+
|
|
38
|
+
- name: Extract base version from pyproject.toml
|
|
39
|
+
id: get_version
|
|
40
|
+
run: |
|
|
41
|
+
python << PYTHON_SCRIPT
|
|
42
|
+
import os
|
|
43
|
+
import sys
|
|
44
|
+
try:
|
|
45
|
+
import tomllib
|
|
46
|
+
with open('pyproject.toml', 'rb') as f:
|
|
47
|
+
data = tomllib.load(f)
|
|
48
|
+
version = data['project']['version']
|
|
49
|
+
except ImportError:
|
|
50
|
+
import tomli
|
|
51
|
+
with open('pyproject.toml', 'rb') as f:
|
|
52
|
+
data = tomli.load(f)
|
|
53
|
+
version = data['project']['version']
|
|
54
|
+
output_file = os.environ['GITHUB_OUTPUT']
|
|
55
|
+
with open(output_file, 'a') as f:
|
|
56
|
+
f.write(f'base_version={version}\n')
|
|
57
|
+
PYTHON_SCRIPT
|
|
58
|
+
|
|
59
|
+
- name: Generate dev version
|
|
60
|
+
id: dev_version
|
|
61
|
+
run: |
|
|
62
|
+
TIMESTAMP=$(date -u +%Y%m%d%H%M%S)
|
|
63
|
+
DEV_VERSION="${{ steps.get_version.outputs.base_version }}dev-$TIMESTAMP"
|
|
64
|
+
echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT
|
|
65
|
+
echo "Generated dev version: $DEV_VERSION"
|
|
66
|
+
|
|
67
|
+
- name: Update pyproject.toml with dev version
|
|
68
|
+
run: |
|
|
69
|
+
python << EOF
|
|
70
|
+
import re
|
|
71
|
+
with open('pyproject.toml', 'r') as f:
|
|
72
|
+
content = f.read()
|
|
73
|
+
content = re.sub(
|
|
74
|
+
r'^version = ".*"',
|
|
75
|
+
f'version = "${{ steps.dev_version.outputs.version }}"',
|
|
76
|
+
content,
|
|
77
|
+
flags=re.MULTILINE
|
|
78
|
+
)
|
|
79
|
+
with open('pyproject.toml', 'w') as f:
|
|
80
|
+
f.write(content)
|
|
81
|
+
EOF
|
|
82
|
+
|
|
83
|
+
- name: Build package
|
|
84
|
+
run: uv build
|
|
85
|
+
|
|
86
|
+
- name: Verify optional dependency isolation
|
|
87
|
+
run: |
|
|
88
|
+
uv venv .venv-isolation
|
|
89
|
+
. .venv-isolation/bin/activate
|
|
90
|
+
WHEEL=$(ls dist/greennode_agent_bridge-*.whl | head -1)
|
|
91
|
+
echo "Testing isolation with wheel: $WHEEL"
|
|
92
|
+
uv pip install "$WHEEL"
|
|
93
|
+
if uv pip show langgraph 2>/dev/null; then
|
|
94
|
+
echo "Error: langgraph must not be installed when using no extras"
|
|
95
|
+
exit 1
|
|
96
|
+
fi
|
|
97
|
+
uv pip uninstall -y greennode-agent-bridge 2>/dev/null || true
|
|
98
|
+
uv pip install "$WHEEL[langgraph]"
|
|
99
|
+
if ! uv pip show langgraph >/dev/null 2>&1; then
|
|
100
|
+
echo "Error: langgraph must be installed when using [langgraph] extra"
|
|
101
|
+
exit 1
|
|
102
|
+
fi
|
|
103
|
+
echo "Optional dependency isolation verified."
|
|
104
|
+
|
|
105
|
+
- name: Publish to TestPyPI
|
|
106
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
107
|
+
with:
|
|
108
|
+
packages-dir: dist/
|
|
109
|
+
repository-url: https://test.pypi.org/legacy/
|
|
110
|
+
|
|
111
|
+
test-publish:
|
|
112
|
+
name: Verify on TestPyPI
|
|
113
|
+
runs-on: ubuntu-latest
|
|
114
|
+
environment: testpypi
|
|
115
|
+
permissions:
|
|
116
|
+
id-token: write
|
|
117
|
+
contents: read
|
|
118
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
119
|
+
steps:
|
|
120
|
+
- name: Checkout code
|
|
121
|
+
uses: actions/checkout@v4
|
|
122
|
+
|
|
123
|
+
- name: Install uv
|
|
124
|
+
uses: astral-sh/setup-uv@v4
|
|
125
|
+
with:
|
|
126
|
+
version: "latest"
|
|
127
|
+
|
|
128
|
+
- name: Set up Python and install dependencies
|
|
129
|
+
run: uv sync --group dev --group build
|
|
130
|
+
|
|
131
|
+
- name: Extract version from tag
|
|
132
|
+
id: get_tag_version
|
|
133
|
+
run: |
|
|
134
|
+
if [[ "${{ github.ref }}" =~ ^refs/tags/v(.+)$ ]]; then
|
|
135
|
+
TAG_VERSION="${BASH_REMATCH[1]}"
|
|
136
|
+
else
|
|
137
|
+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
|
138
|
+
fi
|
|
139
|
+
echo "version=$TAG_VERSION" >> $GITHUB_OUTPUT
|
|
140
|
+
echo "Extracted version from tag: $TAG_VERSION"
|
|
141
|
+
|
|
142
|
+
- name: Update pyproject.toml with tag version
|
|
143
|
+
run: |
|
|
144
|
+
python << EOF
|
|
145
|
+
import re
|
|
146
|
+
with open('pyproject.toml', 'r') as f:
|
|
147
|
+
content = f.read()
|
|
148
|
+
content = re.sub(
|
|
149
|
+
r'^version = ".*"',
|
|
150
|
+
f'version = "${{ steps.get_tag_version.outputs.version }}"',
|
|
151
|
+
content,
|
|
152
|
+
flags=re.MULTILINE
|
|
153
|
+
)
|
|
154
|
+
with open('pyproject.toml', 'w') as f:
|
|
155
|
+
f.write(content)
|
|
156
|
+
EOF
|
|
157
|
+
|
|
158
|
+
- name: Build package
|
|
159
|
+
run: uv build
|
|
160
|
+
|
|
161
|
+
- name: Verify optional dependency isolation
|
|
162
|
+
run: |
|
|
163
|
+
uv venv .venv-isolation
|
|
164
|
+
. .venv-isolation/bin/activate
|
|
165
|
+
WHEEL=$(ls dist/greennode_agent_bridge-*.whl | head -1)
|
|
166
|
+
echo "Testing isolation with wheel: $WHEEL"
|
|
167
|
+
uv pip install "$WHEEL"
|
|
168
|
+
if uv pip show langgraph 2>/dev/null; then
|
|
169
|
+
echo "Error: langgraph must not be installed when using no extras"
|
|
170
|
+
exit 1
|
|
171
|
+
fi
|
|
172
|
+
uv pip uninstall -y greennode-agent-bridge 2>/dev/null || true
|
|
173
|
+
uv pip install "$WHEEL[langgraph]"
|
|
174
|
+
if ! uv pip show langgraph >/dev/null 2>&1; then
|
|
175
|
+
echo "Error: langgraph must be installed when using [langgraph] extra"
|
|
176
|
+
exit 1
|
|
177
|
+
fi
|
|
178
|
+
echo "Optional dependency isolation verified."
|
|
179
|
+
|
|
180
|
+
- name: Publish to TestPyPI
|
|
181
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
182
|
+
with:
|
|
183
|
+
repository-url: https://test.pypi.org/legacy/
|
|
184
|
+
|
|
185
|
+
publish-release:
|
|
186
|
+
name: Publish Release to PyPI
|
|
187
|
+
needs: test-publish
|
|
188
|
+
runs-on: ubuntu-latest
|
|
189
|
+
permissions:
|
|
190
|
+
id-token: write
|
|
191
|
+
contents: read
|
|
192
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
193
|
+
environment:
|
|
194
|
+
name: pypi
|
|
195
|
+
|
|
196
|
+
steps:
|
|
197
|
+
- name: Checkout code
|
|
198
|
+
uses: actions/checkout@v4
|
|
199
|
+
|
|
200
|
+
- name: Install uv
|
|
201
|
+
uses: astral-sh/setup-uv@v4
|
|
202
|
+
with:
|
|
203
|
+
version: "latest"
|
|
204
|
+
|
|
205
|
+
- name: Set up Python and install dependencies
|
|
206
|
+
run: uv sync --group dev --group build
|
|
207
|
+
|
|
208
|
+
- name: Extract version from tag
|
|
209
|
+
id: get_tag_version
|
|
210
|
+
run: |
|
|
211
|
+
if [[ "${{ github.ref }}" =~ ^refs/tags/v(.+)$ ]]; then
|
|
212
|
+
TAG_VERSION="${BASH_REMATCH[1]}"
|
|
213
|
+
else
|
|
214
|
+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
|
215
|
+
fi
|
|
216
|
+
echo "version=$TAG_VERSION" >> $GITHUB_OUTPUT
|
|
217
|
+
echo "Extracted version from tag: $TAG_VERSION"
|
|
218
|
+
|
|
219
|
+
- name: Update pyproject.toml with tag version
|
|
220
|
+
run: |
|
|
221
|
+
python << EOF
|
|
222
|
+
import re
|
|
223
|
+
with open('pyproject.toml', 'r') as f:
|
|
224
|
+
content = f.read()
|
|
225
|
+
content = re.sub(
|
|
226
|
+
r'^version = ".*"',
|
|
227
|
+
f'version = "${{ steps.get_tag_version.outputs.version }}"',
|
|
228
|
+
content,
|
|
229
|
+
flags=re.MULTILINE
|
|
230
|
+
)
|
|
231
|
+
with open('pyproject.toml', 'w') as f:
|
|
232
|
+
f.write(content)
|
|
233
|
+
EOF
|
|
234
|
+
|
|
235
|
+
- name: Build package
|
|
236
|
+
run: uv build
|
|
237
|
+
|
|
238
|
+
- name: Verify optional dependency isolation
|
|
239
|
+
run: |
|
|
240
|
+
uv venv .venv-isolation
|
|
241
|
+
. .venv-isolation/bin/activate
|
|
242
|
+
WHEEL=$(ls dist/greennode_agent_bridge-*.whl | head -1)
|
|
243
|
+
echo "Testing isolation with wheel: $WHEEL"
|
|
244
|
+
uv pip install "$WHEEL"
|
|
245
|
+
if uv pip show langgraph 2>/dev/null; then
|
|
246
|
+
echo "Error: langgraph must not be installed when using no extras"
|
|
247
|
+
exit 1
|
|
248
|
+
fi
|
|
249
|
+
uv pip uninstall -y greennode-agent-bridge 2>/dev/null || true
|
|
250
|
+
uv pip install "$WHEEL[langgraph]"
|
|
251
|
+
if ! uv pip show langgraph >/dev/null 2>&1; then
|
|
252
|
+
echo "Error: langgraph must be installed when using [langgraph] extra"
|
|
253
|
+
exit 1
|
|
254
|
+
fi
|
|
255
|
+
echo "Optional dependency isolation verified."
|
|
256
|
+
|
|
257
|
+
- name: Publish to PyPI
|
|
258
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
259
|
+
with:
|
|
260
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: greennode-agent-bridge
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: A bridge package for connecting multiple agent frameworks (LangGraph, CrewAI, Microsoft Agent Framework, etc.) with GreenNode AgentBase
|
|
5
|
+
Project-URL: Homepage, https://github.com/vngcloud/greennode-agent-bridge
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/vngcloud/greennode-agent-bridge/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/vngcloud/greennode-agent-bridge
|
|
8
|
+
Author-email: GreenNode <opensource@greennode.ai>
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: <4.0,>=3.10
|
|
22
|
+
Requires-Dist: greennode-agentbase>=1.0.0
|
|
23
|
+
Requires-Dist: typing-extensions>=4.0.0; python_version < '3.11'
|
|
24
|
+
Provides-Extra: langgraph
|
|
25
|
+
Requires-Dist: langgraph-checkpoint<5.0.0,>=3.0.0; extra == 'langgraph'
|
|
26
|
+
Requires-Dist: langgraph>=1.0.0; extra == 'langgraph'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# GreenNode Agent Bridge
|
|
30
|
+
|
|
31
|
+
A bridge package for connecting multiple agent frameworks (LangGraph, CrewAI, Microsoft Agent Framework, etc.) with [GreenNode AgentBase](https://github.com/vngcloud/greennode-agentbase). Use your preferred agent framework while persisting state and memory in AgentBase Memory and Runtime services.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Framework adaptors** – Integrate agent frameworks with GreenNode AgentBase Memory and Runtime.
|
|
36
|
+
- **Optional extras** – Install only the frameworks you use; extras are isolated so installing one does not pull in others.
|
|
37
|
+
- **LangGraph support** – First-class support for LangGraph with:
|
|
38
|
+
- **AgentBaseMemoryEvents** – A `BaseCheckpointSaver` that persists LangGraph checkpoints as events in AgentBase Memory.
|
|
39
|
+
- **AgentBaseMemoryRecords** – A `BaseStore` that saves chat messages as conversational events and retrieves memories via semantic search (embedding and processing run in AgentBase Memory).
|
|
40
|
+
|
|
41
|
+
## Requirements
|
|
42
|
+
|
|
43
|
+
- Python 3.10+
|
|
44
|
+
- [GreenNode AgentBase](https://github.com/vngcloud/greennode-agentbase) (core dependency)
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
**Base package** (AgentBase only; no framework adaptors):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install greennode-agent-bridge
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**With LangGraph support**:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install "greennode-agent-bridge[langgraph]"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Other extras (e.g. CrewAI) may be added in future releases. Installing one extra does not install packages from other extras.
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
### LangGraph checkpoint and store
|
|
65
|
+
|
|
66
|
+
When the `[langgraph]` extra is installed, you can use AgentBase Memory as a checkpoint saver and as a store for conversation and memory:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from greennode_agent_bridge import AgentBaseMemoryEvents, AgentBaseMemoryRecords
|
|
70
|
+
|
|
71
|
+
# Checkpoint saver for LangGraph (persists graph state to AgentBase Memory)
|
|
72
|
+
checkpointer = AgentBaseMemoryEvents(
|
|
73
|
+
memory_id="your-memory-id",
|
|
74
|
+
# optional: memory_client=client,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Store for chat messages and semantic memory (saves events, retrieves via AgentBase)
|
|
78
|
+
store = AgentBaseMemoryRecords(
|
|
79
|
+
memory_id="your-memory-id",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
# Use with your LangGraph graph
|
|
83
|
+
# graph = ... .compile(checkpointer=checkpointer)
|
|
84
|
+
# app with store for memory operations
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Configure `memory_id` (and optionally credentials/client) according to your [AgentBase Memory](https://github.com/vngcloud/greennode-agentbase) setup.
|
|
88
|
+
|
|
89
|
+
### Without optional dependencies
|
|
90
|
+
|
|
91
|
+
If you import LangGraph types without installing the `[langgraph]` extra, the package raises an error that tells you to install `greennode-agent-bridge[langgraph]`.
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
- **Lint/format:** [Ruff](https://docs.astral.sh/ruff/)
|
|
96
|
+
- **Type checking:** [mypy](https://mypy-lang.org/)
|
|
97
|
+
- **Tests:** [pytest](https://pytest.org/)
|
|
98
|
+
|
|
99
|
+
With [uv](https://docs.astral.sh/uv/):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
uv sync --group dev --group build
|
|
103
|
+
uv run ruff check src
|
|
104
|
+
uv run pytest
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
Apache-2.0. See [LICENSE](LICENSE) for details.
|
|
110
|
+
|
|
111
|
+
## Links
|
|
112
|
+
|
|
113
|
+
- [Homepage](https://github.com/vngcloud/greennode-agent-bridge)
|
|
114
|
+
- [Bug tracker](https://github.com/vngcloud/greennode-agent-bridge/issues)
|
|
115
|
+
- [GreenNode AgentBase](https://github.com/vngcloud/greennode-agentbase)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# GreenNode Agent Bridge
|
|
2
|
+
|
|
3
|
+
A bridge package for connecting multiple agent frameworks (LangGraph, CrewAI, Microsoft Agent Framework, etc.) with [GreenNode AgentBase](https://github.com/vngcloud/greennode-agentbase). Use your preferred agent framework while persisting state and memory in AgentBase Memory and Runtime services.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Framework adaptors** – Integrate agent frameworks with GreenNode AgentBase Memory and Runtime.
|
|
8
|
+
- **Optional extras** – Install only the frameworks you use; extras are isolated so installing one does not pull in others.
|
|
9
|
+
- **LangGraph support** – First-class support for LangGraph with:
|
|
10
|
+
- **AgentBaseMemoryEvents** – A `BaseCheckpointSaver` that persists LangGraph checkpoints as events in AgentBase Memory.
|
|
11
|
+
- **AgentBaseMemoryRecords** – A `BaseStore` that saves chat messages as conversational events and retrieves memories via semantic search (embedding and processing run in AgentBase Memory).
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Python 3.10+
|
|
16
|
+
- [GreenNode AgentBase](https://github.com/vngcloud/greennode-agentbase) (core dependency)
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
**Base package** (AgentBase only; no framework adaptors):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install greennode-agent-bridge
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**With LangGraph support**:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install "greennode-agent-bridge[langgraph]"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Other extras (e.g. CrewAI) may be added in future releases. Installing one extra does not install packages from other extras.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### LangGraph checkpoint and store
|
|
37
|
+
|
|
38
|
+
When the `[langgraph]` extra is installed, you can use AgentBase Memory as a checkpoint saver and as a store for conversation and memory:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from greennode_agent_bridge import AgentBaseMemoryEvents, AgentBaseMemoryRecords
|
|
42
|
+
|
|
43
|
+
# Checkpoint saver for LangGraph (persists graph state to AgentBase Memory)
|
|
44
|
+
checkpointer = AgentBaseMemoryEvents(
|
|
45
|
+
memory_id="your-memory-id",
|
|
46
|
+
# optional: memory_client=client,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Store for chat messages and semantic memory (saves events, retrieves via AgentBase)
|
|
50
|
+
store = AgentBaseMemoryRecords(
|
|
51
|
+
memory_id="your-memory-id",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Use with your LangGraph graph
|
|
55
|
+
# graph = ... .compile(checkpointer=checkpointer)
|
|
56
|
+
# app with store for memory operations
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Configure `memory_id` (and optionally credentials/client) according to your [AgentBase Memory](https://github.com/vngcloud/greennode-agentbase) setup.
|
|
60
|
+
|
|
61
|
+
### Without optional dependencies
|
|
62
|
+
|
|
63
|
+
If you import LangGraph types without installing the `[langgraph]` extra, the package raises an error that tells you to install `greennode-agent-bridge[langgraph]`.
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
- **Lint/format:** [Ruff](https://docs.astral.sh/ruff/)
|
|
68
|
+
- **Type checking:** [mypy](https://mypy-lang.org/)
|
|
69
|
+
- **Tests:** [pytest](https://pytest.org/)
|
|
70
|
+
|
|
71
|
+
With [uv](https://docs.astral.sh/uv/):
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uv sync --group dev --group build
|
|
75
|
+
uv run ruff check src
|
|
76
|
+
uv run pytest
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
Apache-2.0. See [LICENSE](LICENSE) for details.
|
|
82
|
+
|
|
83
|
+
## Links
|
|
84
|
+
|
|
85
|
+
- [Homepage](https://github.com/vngcloud/greennode-agent-bridge)
|
|
86
|
+
- [Bug tracker](https://github.com/vngcloud/greennode-agent-bridge/issues)
|
|
87
|
+
- [GreenNode AgentBase](https://github.com/vngcloud/greennode-agentbase)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "greennode-agent-bridge"
|
|
7
|
+
version = "1.0.1"
|
|
8
|
+
description = "A bridge package for connecting multiple agent frameworks (LangGraph, CrewAI, Microsoft Agent Framework, etc.) with GreenNode AgentBase"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10,<4.0"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "GreenNode", email = "opensource@greennode.ai" }
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"greennode-agentbase>=1.0.0",
|
|
30
|
+
"typing-extensions>=4.0.0; python_version<'3.11'",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
langgraph = [
|
|
35
|
+
"langgraph-checkpoint>=3.0.0,<5.0.0",
|
|
36
|
+
"langgraph>=1.0.0",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"mypy>=1.0.0",
|
|
42
|
+
"pytest>=8.0.0",
|
|
43
|
+
"ruff>=0.8.0",
|
|
44
|
+
]
|
|
45
|
+
build = [
|
|
46
|
+
"hatchling>=1.0.0",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/vngcloud/greennode-agent-bridge"
|
|
51
|
+
"Bug Tracker" = "https://github.com/vngcloud/greennode-agent-bridge/issues"
|
|
52
|
+
Documentation = "https://github.com/vngcloud/greennode-agent-bridge"
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.wheel]
|
|
55
|
+
packages = ["src/greennode_agent_bridge"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
line-length = 120
|
|
59
|
+
include = ["src/**/*.py"]
|
|
60
|
+
exclude = ["**/*.md"]
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = [
|
|
64
|
+
"B", # flake8-bugbear
|
|
65
|
+
"D", # pydocstyle
|
|
66
|
+
"E", # pycodestyle
|
|
67
|
+
"F", # pyflakes
|
|
68
|
+
"G", # logging format
|
|
69
|
+
"I", # isort
|
|
70
|
+
"LOG", # logging
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[tool.ruff.lint.per-file-ignores]
|
|
74
|
+
"src/**/*.py" = ["D"]
|
|
75
|
+
|
|
76
|
+
[tool.mypy]
|
|
77
|
+
python_version = "3.10"
|
|
78
|
+
warn_return_any = true
|
|
79
|
+
warn_unused_configs = true
|
|
80
|
+
ignore_missing_imports = true
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""GreenNode Agent Bridge - Connect agent frameworks with GreenNode AgentBase.
|
|
2
|
+
|
|
3
|
+
This package provides adaptors for various agent frameworks (LangGraph, CrewAI, etc.)
|
|
4
|
+
to work with GreenNode AgentBase Memory and Runtime services.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
|
|
9
|
+
# Conditional imports for optional dependencies
|
|
10
|
+
try:
|
|
11
|
+
from greennode_agent_bridge.langgraph.memory import (
|
|
12
|
+
AgentBaseMemoryEvents,
|
|
13
|
+
AgentBaseMemoryRecords,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"AgentBaseMemoryEvents",
|
|
18
|
+
"AgentBaseMemoryRecords",
|
|
19
|
+
]
|
|
20
|
+
except ImportError as e:
|
|
21
|
+
# Store the import error for later use
|
|
22
|
+
_import_error = e
|
|
23
|
+
__all__ = []
|
|
24
|
+
|
|
25
|
+
# Provide helpful error message when optional dependencies are missing
|
|
26
|
+
def _missing_langgraph_dependencies_error(*args, **kwargs):
|
|
27
|
+
raise ImportError(
|
|
28
|
+
"LangGraph functionality requires optional dependencies. "
|
|
29
|
+
"Install them with: pip install 'greennode-agent-bridge[langgraph]'"
|
|
30
|
+
) from _import_error
|
|
31
|
+
|
|
32
|
+
# Create placeholder classes that raise helpful error
|
|
33
|
+
AgentBaseMemoryEvents = _missing_langgraph_dependencies_error # type: ignore[assignment]
|
|
34
|
+
AgentBaseMemoryRecords = _missing_langgraph_dependencies_error # type: ignore[assignment]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""LangGraph adaptor for GreenNode AgentBase.
|
|
2
|
+
|
|
3
|
+
This package provides adaptors for LangGraph to work with GreenNode AgentBase.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# Re-export from memory submodule for backward compatibility and convenience
|
|
7
|
+
try:
|
|
8
|
+
from greennode_agent_bridge.langgraph.memory import (
|
|
9
|
+
AgentBaseMemoryEvents,
|
|
10
|
+
AgentBaseMemoryRecords,
|
|
11
|
+
langgraph_available,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"AgentBaseMemoryEvents",
|
|
16
|
+
"AgentBaseMemoryRecords",
|
|
17
|
+
"langgraph_available",
|
|
18
|
+
]
|
|
19
|
+
except ImportError:
|
|
20
|
+
# If memory module is not available, provide empty exports
|
|
21
|
+
__all__ = []
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""LangGraph Memory adaptor for GreenNode AgentBase.
|
|
2
|
+
|
|
3
|
+
This module provides checkpoint saver and store implementations for LangGraph
|
|
4
|
+
using GreenNode AgentBase Memory.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
# Store the import error for later use
|
|
10
|
+
_import_error: ImportError | None = None
|
|
11
|
+
|
|
12
|
+
# Conditional imports for optional dependencies
|
|
13
|
+
try:
|
|
14
|
+
from greennode_agent_bridge.langgraph.memory.events import AgentBaseMemoryEvents
|
|
15
|
+
from greennode_agent_bridge.langgraph.memory.records import AgentBaseMemoryRecords
|
|
16
|
+
|
|
17
|
+
langgraph_available = True
|
|
18
|
+
except ImportError as e:
|
|
19
|
+
# Store the error for later use
|
|
20
|
+
_import_error = e
|
|
21
|
+
langgraph_available = False
|
|
22
|
+
|
|
23
|
+
# If dependencies are not available, provide helpful error message
|
|
24
|
+
def _missing_langgraph_dependencies_error(*args: Any, **kwargs: Any) -> Any:
|
|
25
|
+
raise ImportError(
|
|
26
|
+
"LangGraph functionality requires optional dependencies. "
|
|
27
|
+
"Install them with: pip install 'greennode-agent-bridge[langgraph]'"
|
|
28
|
+
) from _import_error
|
|
29
|
+
|
|
30
|
+
# Create placeholder classes that raise helpful error
|
|
31
|
+
AgentBaseMemoryEvents: type[Any] = _missing_langgraph_dependencies_error # type: ignore[assignment,no-redef]
|
|
32
|
+
AgentBaseMemoryRecords: type[Any] = _missing_langgraph_dependencies_error # type: ignore[assignment,no-redef]
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"AgentBaseMemoryEvents",
|
|
36
|
+
"AgentBaseMemoryRecords",
|
|
37
|
+
"langgraph_available",
|
|
38
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Constants and exceptions for AgentBase Memory Checkpoint Saver."""
|
|
2
|
+
|
|
3
|
+
EMPTY_CHANNEL_VALUE = "_empty"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AgentBaseMemoryError(Exception):
|
|
7
|
+
"""Base exception for AgentBase Memory errors."""
|
|
8
|
+
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EventDecodingError(AgentBaseMemoryError):
|
|
13
|
+
"""Raised when event decoding fails."""
|
|
14
|
+
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class InvalidConfigError(AgentBaseMemoryError):
|
|
19
|
+
"""Raised when configuration is invalid."""
|
|
20
|
+
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class EventNotFoundError(AgentBaseMemoryError):
|
|
25
|
+
"""Raised when expected event is not found."""
|
|
26
|
+
|
|
27
|
+
pass
|