Skip to content

ImportError: SQLiteSession not exported from agents top‑level (missing in latest PyPI / main) #1058

Closed
@EngineerAbdullahIqbal

Description

@EngineerAbdullahIqbal

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:

  1. Create and activate a clean virtual environment.

  2. pip install openai-agents

  3. In a Python REPL or script:

    from agents import SQLiteSession
  4. 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:

  1. Install directly from GitHub main:

    pip install git+https://github.com/openai/openai-agents-python@main
  2. 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) to agents/__init__.py under the existing exports.
  • Cut a patch release of openai-agents on PyPI that includes this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-more-infoWaiting for a reply/more info from the authorquestionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions