From b1f1d0a5bf13302621140f7c703deb1cd6df3d5e Mon Sep 17 00:00:00 2001 From: cthomas Date: Tue, 19 Aug 2025 14:46:30 -0700 Subject: [PATCH] feat: only stream last chunk if client is connected (#4015) --- letta/server/rest_api/streaming_response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/letta/server/rest_api/streaming_response.py b/letta/server/rest_api/streaming_response.py index 4cfe9819..361facff 100644 --- a/letta/server/rest_api/streaming_response.py +++ b/letta/server/rest_api/streaming_response.py @@ -332,5 +332,5 @@ class StreamingResponseWithStatusCode(StreamingResponse): ) capture_sentry_exception(exc) return - if more_body: + if more_body and self._client_connected: await send({"type": "http.response.body", "body": b"", "more_body": False})