Skip to content

Commit 3423f01

Browse files
committed
fix: langgraph dump
Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
1 parent 44d739f commit 3423f01

3 files changed

Lines changed: 682 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2424
- "find user" tool
2525
- Register and invoke async tools in MCP middleware
2626

27-
2827
### Changed
2928
- updated dependencies
3029

ex_app/lib/agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ex_app.lib.nc_model import model
1818
from ex_app.lib.tools import get_tools
1919
from ex_app.lib.memorysaver import MemorySaver
20+
from ex_app.lib.jsonplus import JsonPlusSerializer
2021

2122

2223
# Dummy thread id as we return the whole state
@@ -66,7 +67,7 @@ def load_conversation(conversation_token: str):
6667
# Verify whether this was signed by this instance of context_agent
6768
serialized_state = verify_signature(conversation_token, key)
6869
# Deserialize the saved state
69-
conversation = checkpointer.serde.loads(serialized_state.encode())
70+
conversation = JsonPlusSerializer().loads(serialized_state.encode())
7071
# Get the last checkpoint state
7172
last_checkpoint = conversation['last_checkpoint']
7273
# get the last checkpointer config
@@ -88,7 +89,8 @@ def export_conversation(checkpointer):
8889
last_checkpoint = checkpointer.storage[last_config['configurable']['thread_id']][last_config['configurable']['checkpoint_ns']][last_config['configurable']['checkpoint_id']]
8990
# prepare the to-serialize blob
9091
state = {"last_config": last_config, "last_checkpoint": last_checkpoint}
91-
serialized_state = checkpointer.serde.dumps(state)
92+
serialized_state = JsonPlusSerializer().dumps(state)
93+
print(serialized_state)
9294
# sign the serialized state
9395
conversation_token = add_signature(serialized_state.decode('utf-8'), key)
9496
return conversation_token

0 commit comments

Comments
 (0)