Skip to content

Commit 1935884

Browse files
committed
fix(a2a): register ResponseFormat in checkpoint serializer allowlist
Configure MemorySaver with a JsonPlusSerializer that explicitly allows deserialization of app.agent.ResponseFormat from checkpoints. This silences the langgraph warning about deserializing unregistered types, which will become a hard error in a future version. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
1 parent 1557825 commit 1935884

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

a2a/a2a_currency_converter/app/agent.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99
from langchain_core.tools import tool
1010
from langchain_openai import ChatOpenAI
1111
from langgraph.checkpoint.memory import MemorySaver
12+
from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer
1213
from langgraph.prebuilt import create_react_agent
1314
from pydantic import BaseModel
1415
from pydantic_settings import BaseSettings
1516

16-
memory = MemorySaver()
17+
memory = MemorySaver(
18+
serde=JsonPlusSerializer(
19+
allowed_msgpack_modules=[("app.agent", "ResponseFormat")],
20+
),
21+
)
1722

1823

1924
class Configuration(BaseSettings):

tests/a2a/test_currency_converter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"langgraph",
1616
"langgraph.checkpoint",
1717
"langgraph.checkpoint.memory",
18+
"langgraph.checkpoint.serde",
19+
"langgraph.checkpoint.serde.jsonplus",
1820
"langgraph.prebuilt",
1921
]:
2022
sys.modules.setdefault(mod, MagicMock())

0 commit comments

Comments
 (0)