Skip to content

Add missing list_sessions() method to Python SDK client#153

Merged
friggeri merged 5 commits intomainfrom
copilot/add-list-sessions-method
Jan 23, 2026
Merged

Add missing list_sessions() method to Python SDK client#153
friggeri merged 5 commits intomainfrom
copilot/add-list-sessions-method

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

Implementation Plan for delete_session Method

  • Implement delete_session() method in client.py
  • Add e2e test for delete_session() method
  • Run linter and tests to validate the implementation
  • Run security checks (no vulnerabilities found)
  • Improve exception handling based on code review feedback
Original prompt

This section details on the original issue you should resolve

<issue_title>Python SDK client class don't have list_sessions() method</issue_title>
<issue_description>In python cookbook muilti_seesion manage section,The example show CopilotClient class has list_sessions method.
But in source code,it is not existed. Is this an issue?Or this method should be implemented by user?</issue_description>

<agent_instructions>Add the missing list_sessions method to the Python SDK client. You can look at how it's implemented in the nodejs SDK client for reference.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 23, 2026 17:36
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Copilot AI changed the title [WIP] Add missing list_sessions method to Python SDK client Add missing list_sessions() method to Python SDK client Jan 23, 2026
Copilot AI requested a review from friggeri January 23, 2026 17:41
Copilot AI and others added 2 commits January 23, 2026 17:45
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
@friggeri friggeri marked this pull request as ready for review January 23, 2026 19:00
@friggeri friggeri requested a review from a team as a code owner January 23, 2026 19:00
Copilot AI review requested due to automatic review settings January 23, 2026 19:00
@friggeri friggeri enabled auto-merge January 23, 2026 19:00
@github-actions
Copy link

✅ Cross-SDK Consistency Review

Thank you for adding the missing list_sessions() and delete_session() methods to the Python SDK! This brings Python into parity with Node.js and .NET implementations.

Current Implementation Status

SDK list_sessions delete_session SessionMetadata type
Node.js listSessions() deleteSession()
Python list_sessions() (this PR) delete_session() (this PR) ✅ (this PR)
.NET ListSessionsAsync() DeleteSessionAsync()
Go ❌ Missing ❌ Missing ❌ Missing

🔍 Consistency Gap Identified

The Go SDK is missing both methods and the SessionMetadata type. To maintain feature parity across all SDK implementations, the Go SDK should be updated to include:

  1. ListSessions() method - Should return []SessionMetadata and call the session.list RPC method
  2. DeleteSession(sessionID string) method - Should call the session.delete RPC method
  3. SessionMetadata struct - Should include fields: SessionID, StartTime, ModifiedTime, Summary (optional), and IsRemote

📋 Recommendation

Consider opening a follow-up issue or PR to add these methods to the Go SDK (go/client.go and go/types.go) to ensure all four SDK implementations offer consistent functionality for session management.


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).

AI generated by SDK Consistency Review Agent

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 SessionMetadata TypedDict 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.

@friggeri friggeri added this pull request to the merge queue Jan 23, 2026
Merged via the queue into main with commit 8f3e4ba Jan 23, 2026
30 of 33 checks passed
@friggeri friggeri deleted the copilot/add-list-sessions-method branch January 23, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python SDK client class don't have list_sessions() method

3 participants