Skip to content

fix(samples): use running loop for async input#7878

Open
Ghraven wants to merge 1 commit into
microsoft:mainfrom
Ghraven:fix/sample-input-running-loop
Open

fix(samples): use running loop for async input#7878
Ghraven wants to merge 1 commit into
microsoft:mainfrom
Ghraven:fix/sample-input-running-loop

Conversation

@Ghraven

@Ghraven Ghraven commented Jun 23, 2026

Copy link
Copy Markdown

Problem: two async sample input helpers call asyncio.get_event_loop() from inside async functions before scheduling blocking input() calls in an executor. get_event_loop() is deprecated in this usage and can depend on event loop policy behavior.

Before / after: before, the samples asked the policy for an event loop even though a loop is already running. After, they use asyncio.get_running_loop(), preserving the executor behavior while binding to the active loop explicitly.

Verification:

  • python -m py_compile python\samples\core_semantic_router_agents.py python\samples\core_async_human_in_the_loop\main.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant