From afad58e359b0e1088e0d9313d0df6475d05fecef Mon Sep 17 00:00:00 2001 From: Strands Bot Date: Sun, 8 Feb 2026 21:59:57 +0000 Subject: [PATCH] fix(gemini): handle nested reasoning/tool blocks in thinking mode --- src/strands/models/gemini.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/strands/models/gemini.py b/src/strands/models/gemini.py index 6a6535999..6b55be80f 100644 --- a/src/strands/models/gemini.py +++ b/src/strands/models/gemini.py @@ -465,6 +465,10 @@ async def stream( for part in parts: if part.function_call: + if data_type is not None: + yield self._format_chunk({"chunk_type": "content_stop", "data_type": data_type}) + data_type = None + yield self._format_chunk({"chunk_type": "content_start", "data_type": "tool", "data": part}) yield self._format_chunk({"chunk_type": "content_delta", "data_type": "tool", "data": part}) yield self._format_chunk({"chunk_type": "content_stop", "data_type": "tool", "data": part})