From 3ad617d3ff9a82280fe71dbfb4c7a238b6273238 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Fri, 17 Apr 2026 18:43:21 +0000 Subject: [PATCH 1/2] fix: include reasoning block with empty text and non-empty signature --- src/strands/event_loop/streaming.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strands/event_loop/streaming.py b/src/strands/event_loop/streaming.py index 76eda48bf..2b346c840 100644 --- a/src/strands/event_loop/streaming.py +++ b/src/strands/event_loop/streaming.py @@ -303,7 +303,7 @@ def handle_content_block_stop(state: dict[str, Any]) -> dict[str, Any]: content.append({"text": text}) state["text"] = "" - elif reasoning_text: + elif reasoning_text or "signature" in state: content_block: ContentBlock = { "reasoningContent": { "reasoningText": { From b7cdea3c9e132426e3417fa38163c9f7df360549 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Tue, 21 Apr 2026 07:01:50 +0000 Subject: [PATCH 2/2] test: add test-case for reasoning content block with empty text and non-empty signature --- tests/strands/event_loop/test_streaming.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/strands/event_loop/test_streaming.py b/tests/strands/event_loop/test_streaming.py index 93f8d95f8..be67c0471 100644 --- a/tests/strands/event_loop/test_streaming.py +++ b/tests/strands/event_loop/test_streaming.py @@ -481,6 +481,27 @@ def test_handle_content_block_delta(event: ContentBlockDeltaEvent, event_type, s "redactedContent": b"", }, ), + # Reasoning with empty text but non-empty signature + ( + { + "content": [], + "current_tool_use": {}, + "text": "", + "reasoningText": "", + "signature": "123", + "citationsContent": [], + "redactedContent": b"", + }, + { + "content": [{"reasoningContent": {"reasoningText": {"text": "", "signature": "123"}}}], + "current_tool_use": {}, + "text": "", + "reasoningText": "", + "signature": "123", + "citationsContent": [], + "redactedContent": b"", + }, + ), # redactedContent ( {