Skip to content

Conversation

luke-wriglesworth
Copy link
Contributor

Summary

  • Removes the unused import of Session
  • Update type annotations of MyCustomSession to match the Session protocol

Test plan

This is a documentation only change.

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

Indeed, the sample here should be improved

docs/sessions.md Outdated
@@ -227,7 +227,7 @@ if __name__ == "__main__":
You can implement your own session memory by creating a class that follows the [`Session`][agents.memory.session.Session] protocol:

```python
from agents.memory import Session
from agents.items import TResponseInputItem
from typing import List

class MyCustomSession:
Copy link
Member

Choose a reason for hiding this comment

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

This class should inherit SessionABC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the requested change but noticed that the SessionABC docstring says it should be inherited only for internal implementations. Should we also update this docstring?

class SessionABC(ABC):
"""Abstract base class for session implementations.
Session stores conversation history for a specific session, allowing
agents to maintain context without requiring explicit manual memory management.
This ABC is intended for internal use and as a base class for concrete implementations.
Third-party libraries should implement the Session protocol instead.
"""

@seratch seratch added the documentation Improvements or additions to documentation label Aug 26, 2025
@seratch seratch enabled auto-merge (squash) August 26, 2025 23:00
@seratch seratch merged commit 646c618 into openai:main Aug 26, 2025
5 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.

2 participants