Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
# TODO: enable this https://github.com/openai/openai-agents-python/pull/1961/
# - "3.14"
- "3.14"
env:
OPENAI_API_KEY: fake-for-tests
steps:
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ requires-python = ">=3.9"
license = "MIT"
authors = [{ name = "OpenAI", email = "support@openai.com" }]
dependencies = [
"openai>=2.2,<3",
"pydantic>=2.10, <3",
"openai>=2.6,<3",
"tiktoken>=0.12,<0.13",
Comment thread
seratch marked this conversation as resolved.
Outdated
"pydantic>=2.12.3, <3",
"griffe>=1.5.6, <2",
"typing-extensions>=4.12.2, <5",
"requests>=2.0, <3",
Expand All @@ -24,6 +25,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
Expand Down
14 changes: 13 additions & 1 deletion src/agents/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,19 @@ def run_sync(
conversation_id = kwargs.get("conversation_id")
session = kwargs.get("session")

return asyncio.get_event_loop().run_until_complete(
# Python 3.14 no longer creates a default loop implicitly, so we inspect the running loop.
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = None

if loop is not None:
# This method is only expected to run when no loop is already active.
raise RuntimeError(
"AgentRunner.run_sync() cannot be called when an event loop is already running."
)

return asyncio.run(
self.run(
starting_agent,
input,
Comment thread
seratch marked this conversation as resolved.
Expand Down
Loading