diff --git a/python/restate/ext/langchain/_middleware.py b/python/restate/ext/langchain/_middleware.py index 8b6c70f..1f0aa87 100644 --- a/python/restate/ext/langchain/_middleware.py +++ b/python/restate/ext/langchain/_middleware.py @@ -128,6 +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) + if isinstance(result, ToolMessage): + result.id = str(ctx.uuid()) return result except BaseException: # Unblock the rest of the parallel tool batch, then propagate.