Skip to main content

Overview

Shannon emits real-time events via Server-Sent Events (SSE) to provide visibility into task execution. This document catalogs the 37 event types actually emitted by the platform, their structure, and when they occur. Events provide:
  • Real-time progress - Track task execution as it happens
  • Debugging insights - LLM prompts, tool invocations, agent reasoning
  • Cost monitoring - Track token usage and costs in real-time
  • Multi-agent coordination - Observe team formation and collaboration
  • Error recovery - Monitor error handling and recovery attempts

Event Structure

All events follow this base structure:

Base Fields


Event Categories

Events are organized into logical categories:
  1. Workflow Events - Task lifecycle
  2. Agent Events - Agent execution
  3. Tool Events - Tool invocations
  4. Pattern Events - Cognitive pattern execution
  5. Team Events - Multi-agent coordination
  6. LLM Events - Language model interactions
  7. Progress Events - Task progress and status
  8. System Events - Errors and system state

Event Type Quick Reference

Authoritative list of event types emitted by Shannon: Total: 37 event types Note: Events such as WORKFLOW_FAILED, TASK_COMPLETED, TOOL_COMPLETED, TOOL_FAILED, and BUDGET_UPDATE are not emitted by the streaming API. Failures are surfaced via ERROR_OCCURRED; completion is indicated by WORKFLOW_COMPLETED. STREAM_END is emitted as a lifecycle signal after completion/termination when streaming ends.

Workflow Events

Events related to the overall task workflow.

WORKFLOW_STARTED

Emitted: When a task begins execution Data:
Fields:
  • query: Original task query
  • mode: Execution mode (SIMPLE, STANDARD, COMPLEX)
  • session_id: Session identifier
  • estimated_complexity: Complexity score (0.0-1.0)

WORKFLOW_COMPLETED

Emitted: When a task completes successfully Data:
Fields:
  • result: Final task result
  • duration_ms: Total execution time
  • total_tokens: Cumulative token usage
  • total_cost_usd: Total cost
  • agents_used: Number of agents invoked
  • tools_invoked: Number of tool calls

Selected Examples

AGENT_THINKING

TOOL_INVOKED / TOOL_OBSERVATION

LLM_OUTPUT

ERROR_OCCURRED

APPROVAL_REQUESTED

Common Error Types:
  • BUDGET_EXCEEDED - Cost/token limit reached
  • TIMEOUT - Execution timeout
  • TOOL_EXECUTION_FAILED - Tool error
  • LLM_ERROR - LLM provider error
  • INVALID_INPUT - Malformed request

Agent Events

Events related to individual agent execution.

AGENT_STARTED

Emitted: When an agent begins processing Data:

AGENT_THINKING

Emitted: Agent is reasoning/processing (most frequent event) Data:
Usage: Display as progress indicator to user

AGENT_COMPLETED

Emitted: Agent finished its subtask Data:

AGENT_FAILED

Emitted: Agent encountered an error Data:

Tool Events

Events related to tool invocations.

TOOL_INVOKED

Emitted: When a tool is called Data:

TOOL_OBSERVATION

Emitted: Agent observes a tool result Data:
Fields:
  • tool_name: Name of the tool that was invoked
  • result: Tool output (structured data or text)
  • duration_ms: Tool execution time
  • truncated: Whether result was truncated (true if > 2000 chars)
Note: Large tool results are automatically truncated to 2000 characters with UTF-8 safety to prevent overwhelming the streaming connection. The truncated field indicates if this occurred. Full results are always available in the task completion response.

Pattern Events

Pattern selection and decomposition events are not part of the public streaming schema and are omitted for brevity.

Team Events

Multi-agent team coordination and management.

TEAM_RECRUITED

Emitted: When a team of agents is assembled for execution Data:

TEAM_RETIRED

Emitted: When a team is disbanded after task completion Data:

TEAM_STATUS

Emitted: Periodic updates on multi-agent team coordination Data:

DEPENDENCY_SATISFIED

Emitted: When task dependencies are resolved and execution can proceed Data:

Message Events

Agent-to-agent communication.

MESSAGE_SENT

Emitted: Agent sends message to another agent Data:

MESSAGE_RECEIVED

Emitted: Agent receives message Data:

LLM Events

Language model interaction events for debugging and monitoring.

LLM_PROMPT

Emitted: When a prompt is sent to the LLM (sanitized for privacy) Data:

LLM_PARTIAL

Emitted: Incremental LLM output chunk during streaming Data:

LLM_OUTPUT

Emitted: Final LLM output for a step Data:
Fields:
  • output: Complete LLM response text
  • model: Model used (canonical name)
  • provider: LLM provider (openai, anthropic, google, xai, etc.)
  • usage: OpenAI-compatible usage object containing:
    • total_tokens: Total tokens (input + output)
    • input_tokens: Input/prompt tokens
    • output_tokens: Generated tokens
  • cost_usd: Estimated cost in USD
  • duration_ms: Request duration in milliseconds
Note: Usage metadata follows OpenAI’s standard format and is now available for all providers including OpenAI, Anthropic, Google, Groq, xAI, and OpenAI-compatible endpoints. The usage object structure matches OpenAI’s streaming response format for seamless integration. See the OpenAI-Compatible API for details on using Shannon with OpenAI SDKs.

Progress Events

Task progress and status updates for user feedback.

PROGRESS

Emitted: General progress update during execution Data:

DATA_PROCESSING

Emitted: Agent is processing or analyzing data Data:

WAITING

Emitted: Agent is waiting for resources or responses Data:

System Events

System-level events and errors.

ERROR_OCCURRED

Emitted: System error during execution Data:

ERROR_RECOVERY

Emitted: System is recovering from an error Data:

APPROVAL_REQUESTED

Emitted: Human approval needed to proceed Data:

APPROVAL_DECISION

Emitted: Human has made an approval decision Data:
Decision Values:
  • approved - Action allowed to proceed
  • denied - Action blocked
  • timeout - No decision within timeout period

WORKSPACE_UPDATED

Emitted: Working memory/context updated Data:

ROLE_ASSIGNED

Emitted: Agent role assigned during execution Data:

STATUS_UPDATE

Emitted: General status update for the task or workflow Data:

THREAD_MESSAGE_DELTA

Emitted: Incremental content chunk during streaming response generation Data:

THREAD_MESSAGE_COMPLETED

Emitted: Full message content has been delivered Data:

BUDGET_THRESHOLD

Emitted: Token budget reaches a warning threshold (typically 80% of limit) Data:
Fields:
  • usage_percent: Current usage as a percentage (e.g., 85.0)
  • threshold_percent: Warning threshold percentage (e.g., 80.0)
  • tokens_used: Cumulative tokens consumed so far
  • tokens_budget: Maximum allowed tokens for the task
  • level: Severity level ("warning")
  • budget_type: Type of budget that triggered the event ("task")
Usage: Monitor this event to warn users before hitting hard budget limits, allowing graceful degradation or early termination decisions.

Event Ordering

Events are strictly ordered by sequence number (seq):
Properties:
  • Sequence numbers are monotonically increasing
  • No gaps in sequence (every number from 1 to N)
  • Events from same workflow always ordered correctly

Typical Event Flow (Simplified)

Event Persistence

Events are stored in:
  • PostgreSQL: Permanent event log
  • Redis: Recent events (hot cache)
  • Real-time: SSE stream
Retrieving Historical Events:

Event Reliability and Guarantees

Ordering Guarantees

Shannon provides strict ordering within a single workflow:
  • Events are numbered sequentially (seq field)
  • No gaps in sequence numbers (1, 2, 3, …)
  • Events from the same workflow always arrive in order
  • Events from different workflows may be interleaved

Delivery Guarantees

  • At-least-once delivery: Events may be delivered multiple times (use seq for deduplication)
  • Event persistence: All events stored in PostgreSQL event_logs table
  • Hot cache: Recent events cached in Redis for fast retrieval
  • Historical access: Query past events via REST API

Stream Reconnection

If SSE connection drops:

Event Retention

PostgreSQL Selective Persistence: To optimize database performance, only critical events are persisted to PostgreSQL, including: WORKFLOW_COMPLETED, AGENT_COMPLETED, TOOL_INVOKED, LLM_OUTPUT, and ERROR_OCCURRED. Ephemeral events like LLM_PARTIAL, HEARTBEAT, and AGENT_THINKING are excluded from database writes (reducing write load by ~92%) but remain fully available via real-time SSE streaming and Redis cache. See Database Schema for event storage details.

Streaming API

SSE and WebSocket streaming

Python SDK Streaming

SDK streaming guide

List Tasks

View task history

Troubleshooting

Debug streaming issues