From 5c2e3aed8c1eace9df30c96c845fb40feb3f1e59 Mon Sep 17 00:00:00 2001 From: Giselle van Dongen Date: Mon, 25 May 2026 08:23:06 +0200 Subject: [PATCH 1/2] Journal tool message ID --- python/restate/ext/langchain/_middleware.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/restate/ext/langchain/_middleware.py b/python/restate/ext/langchain/_middleware.py index 8b6c70f..d6621c4 100644 --- a/python/restate/ext/langchain/_middleware.py +++ b/python/restate/ext/langchain/_middleware.py @@ -128,6 +128,7 @@ async def awrap_tool_call( await turnstile.wait_for(tool_call_id) result = await handler(request) turnstile.allow_next_after(tool_call_id) + result.id = str(ctx.uuid()) return result except BaseException: # Unblock the rest of the parallel tool batch, then propagate. From 505062f80e6167a5a69018f6e97f548c0706a06b Mon Sep 17 00:00:00 2001 From: Giselle van Dongen Date: Wed, 27 May 2026 09:11:47 +0200 Subject: [PATCH 2/2] Journal tool message ID for tool messages --- python/restate/ext/langchain/_middleware.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/restate/ext/langchain/_middleware.py b/python/restate/ext/langchain/_middleware.py index d6621c4..1f0aa87 100644 --- a/python/restate/ext/langchain/_middleware.py +++ b/python/restate/ext/langchain/_middleware.py @@ -128,7 +128,8 @@ async def awrap_tool_call( await turnstile.wait_for(tool_call_id) result = await handler(request) turnstile.allow_next_after(tool_call_id) - result.id = str(ctx.uuid()) + if isinstance(result, ToolMessage): + result.id = str(ctx.uuid()) return result except BaseException: # Unblock the rest of the parallel tool batch, then propagate.