Skip to content

docs(python): fix KAgentSession import path in kagent-openai README#2163

Merged
EItanya merged 2 commits into
kagent-dev:mainfrom
anxkhn:docs/fix-openai-readme-session-import
Jul 7, 2026
Merged

docs(python): fix KAgentSession import path in kagent-openai README#2163
EItanya merged 2 commits into
kagent-dev:mainfrom
anxkhn:docs/fix-openai-readme-session-import

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 6, 2026

Copy link
Copy Markdown
Contributor
## What

The Session Management example in `python/packages/kagent-openai/README.md`
imports `KAgentSession` from a package path that does not exist:

```python
from kagent.openai.agent._session_service import KAgentSession

There is no agent subpackage under kagent/openai/. The directory
src/kagent/openai/ contains the flat modules _a2a.py, _agent_executor.py,
_event_converter.py, _session_service.py, and a tools/ package. Running
the snippet as written raises:

ModuleNotFoundError: No module named 'kagent.openai.agent'

Fix

Point the import at kagent.openai._session_service, where KAgentSession is
actually defined (_session_service.py) and how the package's own code imports
it (_agent_executor.py uses from ._session_service import KAgentSession):

from kagent.openai._session_service import KAgentSession

Verification

With the kagent-openai package installed:

$ python -c "from kagent.openai.agent._session_service import KAgentSession"
ModuleNotFoundError: No module named 'kagent.openai.agent'

$ python -c "from kagent.openai._session_service import KAgentSession"
# imports cleanly

Docs-only change; no source behavior is affected.

The Session Management example imports KAgentSession from
kagent.openai.agent._session_service, but there is no `agent`
subpackage under kagent/openai/. The module lives directly at
kagent/openai/_session_service.py, so copy-pasting the snippet raises
ModuleNotFoundError: No module named 'kagent.openai.agent'.

Point the import at kagent.openai._session_service, which is where
KAgentSession is defined and how the package's own code imports it.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 6, 2026 08:01
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the kagent-openai README’s Session Management example so it imports KAgentSession from the actual module location (kagent.openai._session_service) rather than a non-existent kagent.openai.agent subpackage, preventing a runtime ModuleNotFoundError for users following the docs.

Changes:

  • Update the README example import path for KAgentSession to kagent.openai._session_service.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@supreme-gg-gg supreme-gg-gg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the catch!

@supreme-gg-gg supreme-gg-gg requested a review from a team as a code owner July 7, 2026 15:27
@EItanya EItanya merged commit c72c110 into kagent-dev:main Jul 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants