Skip to content

Conversation

@rapsealk
Copy link
Member

Resolves #8131 (BA-3948)

This pull request introduces a new client SDK Events class and associated CLI commands to enable real-time streaming of session/kernel lifecycle events and background task events via Server-Sent Events (SSE). It also integrates the Events API into the session client and makes some minor dependency import fixes.

Event Streaming Functionality

  • Added a new Events class in src/ai/backend/client/func/events.py to provide async methods for subscribing to session and background task events using SSE.
  • Registered the Events API in the AsyncSession class, making it accessible via session.Events. [1] [2] [3]

CLI Enhancements

  • Introduced new CLI commands under the events group in src/ai/backend/client/cli/events.py:
    • listen-session: Stream session/kernel events with filtering and wait options.
    • listen-background-task: Stream background task events for a given task ID. [1] [2]

Documentation

  • Added a .feature.md entry describing the new event streaming capabilities for both SDK and CLI.

Dependency Import Fixes

  • Fixed import of ClosingError in valkey_client/client.py and TimeoutError in valkey_stream/client.py to use the correct module paths. [1] [2] [3]

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options
  • Update of end-to-end CLI integration tests in ai.backend.test
  • API server-client counterparts (e.g., manager API -> client SDK)
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation
  • Documentation
    • Contents in the docs directory
    • docstrings in public interfaces and type annotations

rapsealk and others added 2 commits January 19, 2026 17:49
Add Events class to client SDK with listen_session_events() and
listen_background_task_events() methods for SSE-based real-time event
streaming. Add CLI commands for listening to session/kernel lifecycle
events and background task events with filtering and wait options.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@rapsealk rapsealk added this to the 26.1 milestone Jan 19, 2026
@github-actions github-actions bot added size:L 100~500 LoC comp:client Related to Client component comp:common Related to Common component comp:cli Related to CLI component labels Jan 19, 2026
@HyeockJinKim HyeockJinKim modified the milestones: 26.1, 26.2 Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:cli Related to CLI component comp:client Related to Client component comp:common Related to Common component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add client SDK and CLI support for events APIs

2 participants