diff --git a/python/samples/core_async_human_in_the_loop/main.py b/python/samples/core_async_human_in_the_loop/main.py index 6da0c3e80477..c42589a377f4 100644 --- a/python/samples/core_async_human_in_the_loop/main.py +++ b/python/samples/core_async_human_in_the_loop/main.py @@ -322,7 +322,7 @@ async def main(model_config: Dict[str, Any], latest_user_input: Optional[str] = async def ainput(prompt: str = "") -> str: with ThreadPoolExecutor(1, "AsyncInput") as executor: - return await asyncio.get_event_loop().run_in_executor(executor, input, prompt) + return await asyncio.get_running_loop().run_in_executor(executor, input, prompt) if __name__ == "__main__": diff --git a/python/samples/core_semantic_router/_agents.py b/python/samples/core_semantic_router/_agents.py index c39a7c84787f..64aa76ae97e5 100644 --- a/python/samples/core_semantic_router/_agents.py +++ b/python/samples/core_semantic_router/_agents.py @@ -64,5 +64,5 @@ async def on_agent_message(self, message: WorkerAgentMessage, ctx: MessageContex async def get_user_input(self, prompt: str) -> str: """Get user input from the console. Override this method to customize how user input is retrieved.""" - loop = asyncio.get_event_loop() + loop = asyncio.get_running_loop() return await loop.run_in_executor(None, input, prompt)