Skip to content

Implement WebSocket real-time feed using Litestar channels plugin #34

@Aureliolo

Description

@Aureliolo

Context

Implement real-time WebSocket streaming using Litestar's built-in channels plugin for pub/sub broadcasting. The channels plugin handles connection management, per-channel subscriptions, backpressure, and subscriber backlog out of the box.

Streamed events include:

  • Agent messages (inter-agent communication)
  • Task status changes (created, assigned, in progress, completed, failed)
  • Budget and cost update events (spending events, budget warnings)
  • System events (agent hired/fired, errors)

Acceptance Criteria

  • Litestar channels plugin configured with channel definitions
  • Channels for each event type: tasks, agents, budget, messages, system
  • WebSocket endpoint at /api/v1/ws with channel subscription support
  • Clients can subscribe to specific channels (filter by event type, agent, project)
  • JSON message format with event type, timestamp, and payload
  • Integration with message bus from M4 for event sourcing
  • Backpressure handling configured (backoff or eviction strategy)
  • Connection heartbeat/ping-pong for keep-alive
  • Unit tests for channel event serialization and subscription

Dependencies

Design Spec Reference

  • §13.1 — API architecture (real-time requirements)

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumShould do, but not blockingscope:medium1-3 days of workspec:agent-systemDESIGN_SPEC Section 3 - Agent Systemspec:architectureDESIGN_SPEC Section 15 - Technical Architecturespec:communicationDESIGN_SPEC Section 5 - Communication Architecturespec:human-interactionDESIGN_SPEC Section 13 - Human Interaction Layertype:featureNew feature implementationtype:testTest coverage, test infrastructure

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions