Overview
Shannon emits real-time events via Server-Sent Events (SSE) to provide visibility into task execution. This document catalogs the 33 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
| Field | Type | Description |
|---|---|---|
workflow_id | string | Unique task/workflow identifier |
type | string | Event type (see catalog below) |
agent_id | string | Agent that emitted the event |
message | string | Human-readable event description |
timestamp | ISO 8601 | When the event occurred |
seq | integer | Sequence number for ordering |
stream_id | string | Stream identifier for reconnection |
payload | object | Event-specific payload (optional; serialized as payload in JSON) |
Event Categories
Events are organized into logical categories:- Workflow Events - Task lifecycle
- Agent Events - Agent execution
- Tool Events - Tool invocations
- Pattern Events - Cognitive pattern execution
- Team Events - Multi-agent coordination
- LLM Events - Language model interactions
- Progress Events - Task progress and status
- System Events - Errors and system state
Event Type Quick Reference
Authoritative list of event types emitted by Shannon:| Event Type | Category | Description |
|---|---|---|
WORKFLOW_STARTED | Workflow | Task begins execution |
WORKFLOW_COMPLETED | Workflow | Task completes successfully |
WORKFLOW_PAUSING | Workflow control | Pause requested; workflow preparing to pause |
WORKFLOW_PAUSED | Workflow control | Workflow paused at a checkpoint |
WORKFLOW_RESUMED | Workflow control | Workflow resumed after pause |
WORKFLOW_CANCELLING | Workflow control | Cancel requested; workflow preparing to terminate |
WORKFLOW_CANCELLED | Workflow control | Workflow cancelled at a checkpoint |
AGENT_STARTED | Agent | Agent begins processing |
AGENT_THINKING | Agent | Agent reasoning/planning |
AGENT_COMPLETED | Agent | Agent finishes successfully |
TOOL_INVOKED | Tool | Tool is called |
TOOL_OBSERVATION | Tool | Agent observes tool result |
TEAM_RECRUITED | Team | Multi-agent team assembled |
TEAM_RETIRED | Team | Team disbanded |
TEAM_STATUS | Team | Team coordination update |
DEPENDENCY_SATISFIED | Team | Dependencies resolved |
MESSAGE_SENT | Message | Agent sends message |
MESSAGE_RECEIVED | Message | Agent receives message |
LLM_PROMPT | LLM | Prompt sent to LLM |
LLM_PARTIAL | LLM | Incremental LLM output |
LLM_OUTPUT | LLM | Final LLM output |
PROGRESS | Progress | General progress update |
DATA_PROCESSING | Progress | Processing/analyzing data |
WAITING | Progress | Waiting for resources |
ERROR_OCCURRED | System | Error occurred |
ERROR_RECOVERY | System | Error recovery attempt |
APPROVAL_REQUESTED | System | Human approval needed |
APPROVAL_DECISION | System | Approval decision made |
WORKSPACE_UPDATED | System | Memory/context updated |
ROLE_ASSIGNED | System | Agent role assigned |
DELEGATION | System | Task delegated |
BUDGET_THRESHOLD | System/Progress | Budget warning threshold reached for a task |
STREAM_END | Stream | Explicit end-of-stream signal (no more events for this workflow) |
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:query: Original task querymode: Execution mode (SIMPLE, STANDARD, COMPLEX)session_id: Session identifierestimated_complexity: Complexity score (0.0-1.0)
WORKFLOW_COMPLETED
Emitted: When a task completes successfully Data:result: Final task resultduration_ms: Total execution timetotal_tokens: Cumulative token usagetotal_cost_usd: Total costagents_used: Number of agents invokedtools_invoked: Number of tool calls
Selected Examples
AGENT_THINKING
TOOL_INVOKED / TOOL_OBSERVATION
LLM_OUTPUT
ERROR_OCCURRED
APPROVAL_REQUESTED
BUDGET_EXCEEDED- Cost/token limit reachedTIMEOUT- Execution timeoutTOOL_EXECUTION_FAILED- Tool errorLLM_ERROR- LLM provider errorINVALID_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: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:tool_name: Name of the tool that was invokedresult: Tool output (structured data or text)duration_ms: Tool execution timetruncated: Whether result was truncated (true if > 2000 chars)
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:output: Complete LLM response textmodel: 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 tokensoutput_tokens: Generated tokens
cost_usd: Estimated cost in USDduration_ms: Request duration in milliseconds
usage object structure matches OpenAI’s streaming response format for seamless integration.
TOOL_OBSERVATION
Emitted: Tool result observation by agent Data: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:approved- Action allowed to proceeddenied- Action blockedtimeout- No decision within timeout period
WORKSPACE_UPDATED
Emitted: Working memory/context updated Data:ROLE_ASSIGNED
Emitted: Agent role assigned during execution Data:DELEGATION
Emitted: Task delegated to another agent Data:BUDGET_THRESHOLD
Emitted: Token budget reaches a warning threshold (typically 80% of limit) Data:threshold_percentage: Warning threshold (e.g., 80)tokens_used: Cumulative tokens consumed so fartokens_limit: Maximum allowed tokens for tasktokens_remaining: Tokens left before limitcost_usd: Current cost in USDestimated_cost_at_limit: Projected cost if limit is reached
Event Ordering
Events are strictly ordered by sequence number (seq):
- 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
Event Reliability and Guarantees
Ordering Guarantees
Shannon provides strict ordering within a single workflow:- Events are numbered sequentially (
seqfield) - 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
seqfor deduplication) - Event persistence: All events stored in PostgreSQL
event_logstable - 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
| Storage | Retention Period | Purpose | Event Types |
|---|---|---|---|
| Redis | 24 hours | Real-time streaming | All events |
| PostgreSQL | 90 days (default) | Historical queries | Critical events only* |
| Archival | 1+ years (optional) | Long-term audit | Configurable |
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.