diff --git a/luxx/services/agentic_loop.py b/luxx/services/agentic_loop.py index 324a888..92d55bb 100644 --- a/luxx/services/agentic_loop.py +++ b/luxx/services/agentic_loop.py @@ -155,12 +155,14 @@ class AgenticLoop: if thinking: ctx.full_thinking += thinking - ctx.start_step(StepType.THINKING) + if ctx.current_step_type != StepType.THINKING: + ctx.start_step(StepType.THINKING) events.append(StreamRenderer.render_thinking(ctx)) ctx.finalize_step() if text: ctx.full_content += text - ctx.start_step(StepType.TEXT) + if ctx.current_step_type != StepType.TEXT: + ctx.start_step(StepType.TEXT) events.append(StreamRenderer.render_text(ctx)) ctx.finalize_step()