We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1c5b66 commit 3502d2bCopy full SHA for 3502d2b
src/agents/run.py
@@ -720,7 +720,19 @@ def run_sync(
720
conversation_id = kwargs.get("conversation_id")
721
session = kwargs.get("session")
722
723
- return asyncio.get_event_loop().run_until_complete(
+ # Python 3.14 no longer creates a default loop implicitly, so we inspect the running loop.
724
+ try:
725
+ loop = asyncio.get_running_loop()
726
+ except RuntimeError:
727
+ loop = None
728
+
729
+ if loop is not None:
730
+ # This method is only expected to run when no loop is already active.
731
+ raise RuntimeError(
732
+ "AgentRunner.run_sync() cannot be called when an event loop is already running."
733
+ )
734
735
+ return asyncio.run(
736
self.run(
737
starting_agent,
738
input,
0 commit comments