Skip to content

Commit 696b1b1

Browse files
committed
clean up comments
1 parent 43909a8 commit 696b1b1

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/agents/run.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,6 @@ async def _run_single_turn_streamed(
843843
all_tools: list[Tool],
844844
previous_response_id: str | None,
845845
) -> SingleStepResult:
846-
# Track tool call IDs we've already emitted to avoid duplicates when we later
847-
# enqueue all items at the end of the turn.
848846
emitted_tool_call_ids: set[str] = set()
849847

850848
if should_run_agent_start_hooks:
@@ -891,8 +889,6 @@ async def _run_single_turn_streamed(
891889
previous_response_id=previous_response_id,
892890
prompt=prompt_config,
893891
):
894-
# 1. If the event signals the end of the assistant response, remember it so we can
895-
# process the full response after the streaming loop.
896892
if isinstance(event, ResponseCompletedEvent):
897893
usage = (
898894
Usage(
@@ -913,8 +909,6 @@ async def _run_single_turn_streamed(
913909
)
914910
context_wrapper.usage.add(usage)
915911

916-
# 2. Detect tool call output-item additions **while** the model is still streaming.
917-
# Emit a high-level RunItemStreamEvent so UIs can react immediately.
918912
if isinstance(event, ResponseOutputItemAddedEvent):
919913
output_item = event.item
920914

@@ -929,10 +923,8 @@ async def _run_single_turn_streamed(
929923
RunItemStreamEvent(item=tool_item, name="tool_called")
930924
)
931925

932-
# Always forward the raw event.
933926
streamed_result._event_queue.put_nowait(RawResponsesStreamEvent(data=event))
934927

935-
# 2. At this point, the streaming is complete for this turn of the agent loop.
936928
if not final_response:
937929
raise ModelBehaviorError("Model did not produce a final response!")
938930

@@ -951,9 +943,8 @@ async def _run_single_turn_streamed(
951943
tool_use_tracker=tool_use_tracker,
952944
)
953945

954-
# Remove tool_called items we've already emitted during streaming to avoid duplicates.
955946
if emitted_tool_call_ids:
956-
import dataclasses as _dc # local import to avoid polluting module namespace
947+
import dataclasses as _dc
957948

958949
filtered_items = [
959950
item

0 commit comments

Comments
 (0)