@@ -664,46 +664,17 @@ async def run_agent_streamed_auto_send(
664664
665665 elif event .item .type == "message" :
666666 # Handle message items - these are the actual text responses
667- # We need to create a streaming context for these to be displayed
667+ # Streaming context will be created when we receive the first delta
668668 message_item = event .item .raw_item
669-
670- # Create a streaming context that will be populated by text deltas
671- streaming_context = self .streaming_service .streaming_task_message_context (
672- task_id = task_id ,
673- initial_content = TextContent (
674- author = "agent" ,
675- content = "" ,
676- ),
677- )
678- # Open the streaming context and store it with the item ID
679- item_id_to_streaming_context [
680- message_item .id
681- ] = await streaming_context .open ()
682- unclosed_item_ids .add (message_item .id )
669+ # Just track the item ID for now
670+ # The streaming context will be created on first delta
683671
684672 elif event .item .type == "reasoning_item" :
685673 # Handle reasoning items
674+ # Streaming context will be created when we receive the first delta
686675 reasoning_item = event .item .raw_item
687-
688- # Create an empty reasoning context that will be filled by deltas
689- # just like we do for message items
690- empty_reasoning_content = ReasoningContent (
691- author = "agent" ,
692- style = "static" ,
693- summary = [],
694- content = None ,
695- type = "reasoning" ,
696- )
697-
698- streaming_context = self .streaming_service .streaming_task_message_context (
699- task_id = task_id ,
700- initial_content = empty_reasoning_content ,
701- )
702- # Open the context and store it
703- item_id_to_streaming_context [
704- reasoning_item .id
705- ] = await streaming_context .open ()
706- unclosed_item_ids .add (reasoning_item .id )
676+ # Just track the item ID for now
677+ # The streaming context will be created on first delta
707678
708679 elif event .type == "raw_response_event" :
709680 if isinstance (event .data , ResponseTextDeltaEvent ):
0 commit comments