Skip to content

Commit 9527994

Browse files
author
Charlotte Zhuang
committed
fix errors
1 parent e3365e5 commit 9527994

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/tutorials/10_agentic/10_temporal/011_custom_agent_chat/project/special_run_agent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,20 @@ async def special_run_agent(params: SpecialRunAgentParams) -> SpecialRunAgentRes
212212

213213
# Finish the streaming context (sends DONE event and updates message)
214214
if maybe_item_id and maybe_item_id in item_id_to_streaming_context:
215-
streaming_context = item_id_to_streaming_context[item_id]
215+
streaming_context = item_id_to_streaming_context[maybe_item_id]
216216
await streaming_context.close()
217-
unclosed_item_ids.remove(item_id)
217+
unclosed_item_ids.remove(maybe_item_id)
218218

219219
elif event.data.type == "response.completed":
220220
# All items complete, finish all remaining streaming contexts for this session
221-
for item_id in unclosed_item_ids:
221+
for item_id in list(unclosed_item_ids):
222222
streaming_context = item_id_to_streaming_context[item_id]
223223
await streaming_context.close()
224224
unclosed_item_ids.remove(item_id)
225225

226226
finally:
227227
# Cleanup: ensure all streaming contexts for this session are properly finished
228-
for item_id in unclosed_item_ids:
228+
for item_id in list(unclosed_item_ids):
229229
streaming_context = item_id_to_streaming_context[item_id]
230230
await streaming_context.close()
231231
unclosed_item_ids.remove(item_id)

0 commit comments

Comments
 (0)