Description
Description:
When installing the latest release of the SDK (or pulling the main
branch), from agents import SQLiteSession
fails with:
ImportError: cannot import name 'SQLiteSession' from 'agents'
It appears that although the Sessions feature (PR #752, July 10 2025) landed on main
, the top‑level re‑export of SQLiteSession
hasn’t been merged (or isn’t yet published to PyPI).
Steps to Reproduce:
-
Create and activate a clean virtual environment.
-
pip install openai-agents
-
In a Python REPL or script:
from agents import SQLiteSession
-
Observe the
ImportError
.
Expected Behavior:
The import should succeed, as documented in the Sessions guide:
from agents import Agent, Runner, SQLiteSession
Actual Behavior:
Import fails. The class exists in agents/sessions/session.py
, but is not re‑exported in agents/__init__.py
.
Workarounds:
-
Install directly from GitHub main:
pip install git+https://github.com/openai/openai-agents-python@main
-
Or import from its module path:
from agents.sessions.session import SQLiteSession
These are suboptimal until the next PyPI release or until __init__.py
is updated.
Suggested Fix:
- Add
from .sessions.session import SQLiteSession
(and any other new sessions classes) toagents/__init__.py
under the existing exports. - Cut a patch release of
openai-agents
on PyPI that includes this change.