Skip to main content

Overview

Shannon provides real-time event streaming so you can monitor task execution as it happens. This is essential for:
  • Providing live feedback to users
  • Debugging workflow execution
  • Building interactive UIs
  • Monitoring long-running tasks

Streaming Technologies

Shannon supports two streaming protocols:
SSE is recommended for most use cases due to its simplicity and built-in reconnection handling.

Server-Sent Events (SSE)

Using cURL

Output:

Using Python SDK

Event Types

Shannon emits 33 event types across different categories. Here are the most commonly used ones:

Core Workflow Events

LLM & Tool Events

Progress & Status Events

Multi-Agent Events (requires feature gates)

For a complete list of all 27 event types, see the Event Types Reference.

WebSocket Streaming

Connect via WebSocket

WebSocket streaming is currently server-to-client only. Use the REST API /api/v1/tasks/{id}/cancel to cancel tasks.

Filtering Events

Filter events by type to reduce noise:

Progress Tracking

Calculate task progress from events:
Output:

Real-Time UI Example

React Component

Key Implementation Details:
  • Shannon emits named SSE events (e.g., event: AGENT_STARTED), so you must use addEventListener() for each event type
  • Browser EventSource API doesn’t support custom headers. Do not pass API keys via query params; use a backend proxy to inject headers or disable auth in development
  • Always clean up event listeners in the cleanup function to prevent memory leaks

Error Handling

Handle connection failures gracefully:

Authentication with Streaming

When authentication is enabled, provide API key:

SSE with API Key

Python SDK with API Key

Performance Considerations

Event Buffering

Shannon buffers events to prevent overwhelming clients:

Keepalive

SSE sends keepalive comments every 15 seconds to prevent timeout:

Resource Cleanup

Always close streams when done:

Multi-Task Monitoring

Monitor multiple tasks simultaneously:

Desktop Application

Shannon provides a native desktop application built with Tauri for real-time task monitoring and management. The desktop app offers:
  • Live event streaming for active tasks
  • Task submission and management interface
  • Real-time metrics and visualizations
  • Session history browsing
The desktop application has replaced the previous web dashboard. See the Desktop App Guide for installation and usage instructions.

Best Practices

1. Use SSE for Simple Monitoring

2. Handle Disconnections

3. Filter Unnecessary Events

4. Set Timeouts

Next Steps

Python SDK

Async streaming with SDK

API Reference

Streaming API details

Monitoring

Task monitoring guide

WebSocket API

WebSocket documentation