Add missing list_sessions() method to Python SDK client#153
Conversation
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
✅ Cross-SDK Consistency ReviewThank you for adding the missing Current Implementation Status
🔍 Consistency Gap IdentifiedThe Go SDK is missing both methods and the
📋 RecommendationConsider opening a follow-up issue or PR to add these methods to the Go SDK ( Note: The Python implementation in this PR looks solid and follows the same patterns as Node.js and .NET. The API design is consistent with language conventions (snake_case for Python vs camelCase for Node.js vs PascalCase for .NET).
|
There was a problem hiding this comment.
Pull request overview
This PR adds the missing list_sessions() method to the Python SDK client, along with a delete_session() method for session management. The original issue #130 reported that the Python SDK was missing the list_sessions() method that was documented in the cookbook examples.
Changes:
- Added
list_sessions()method to retrieve all available sessions from the server - Added
delete_session()method to permanently remove sessions - Added
SessionMetadataTypedDict for session metadata structure - Added comprehensive E2E tests for both new methods
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/copilot/client.py | Implements list_sessions() and delete_session() methods with proper error handling and thread-safe session map cleanup |
| python/copilot/types.py | Adds SessionMetadata TypedDict to define the structure of session metadata returned by the server |
| python/copilot/init.py | Exports the new SessionMetadata type for public API usage |
| python/e2e/test_session.py | Adds two E2E tests validating list_sessions() returns proper metadata and delete_session() properly removes sessions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Implementation Plan for delete_session Method
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.