WebSocket Events Reference
This document covers control messages and stream events sent by the Aragora
WebSocket server. Stream events use the StreamEvent envelope from
aragora/events/types.py (re-exported by aragora/server/stream/events.py).
Connection
Endpoint
ws://localhost:8765/ws
wss://api.aragora.ai/ws # Production
The WebSocket server accepts / or /ws. The live UI uses /ws.
The server broadcasts all events to all connected clients, so clients should
filter by loop_id (or data.debate_id) when they only care about one debate.
Authentication
If ARAGORA_API_TOKEN is set, include an Authorization: Bearer header during
the handshake:
wscat -c ws://localhost:8765/ws -H "Authorization: Bearer $ARAGORA_API_TOKEN"
Browser clients cannot set custom headers; the server accepts a token query
parameter for WebSocket authentication (e.g. wss://.../ws?token=...).
SDK note: The Python streaming client (AragoraWebSocket) appends the API
key as a token query parameter. Header-based auth is still supported for
proxies or non-browser clients.
Initial Messages
On connection, the server sends:
connection_info(auth and client metadata)loop_list(active loops/debates)syncfor each cached loop state (DebateStreamServer on port 8765 only)
Example:
{
"type": "connection_info",
"data": {
"authenticated": false,
"client_id": "abc123...",
"write_access": true
}
}
Client → Server Messages
Request loop list
{ "type": "get_loops" }
Submit a vote
{
"type": "user_vote",
"loop_id": "loop_abc123",
"payload": {
"choice": "Option A",
"intensity": 7
}
}
Submit a suggestion
{
"type": "user_suggestion",
"loop_id": "loop_abc123",
"payload": {
"text": "Consider a phased rollout for safety."
}
}
Submit audience wisdom
{
"type": "wisdom_submission",
"loop_id": "loop_abc123",
"text": "Start with a rollback plan and chaos testing."
}
The server replies with ack, error, or auth_revoked depending on the
request and auth state.
Stream Event Envelope
Stream events (emitted by SyncEventEmitter) share a common envelope:
{
"type": "consensus",
"data": { "reached": true, "confidence": 0.88, "answer": "Use token bucket" },
"timestamp": 1732735053.123,
"round": 3,
"agent": "anthropic-api",
"seq": 42,
"agent_seq": 7,
"loop_id": "loop_abc123"
}
Notes:
timestampis epoch seconds (float).loop_idis present when the emitter is scoped to a debate/loop.round,agent, andagent_seqare populated when relevant.
Common Event Payloads
These payloads are emitted by create_arena_hooks():
{ "type": "debate_start", "data": { "task": "...", "agents": ["a", "b"] } }
{ "type": "round_start", "data": { "round": 1 } }
{ "type": "agent_message", "data": { "content": "...", "role": "proposal" } }
{ "type": "critique", "data": { "target": "...", "issues": ["..."], "severity": 0.4, "content": "..." } }
{ "type": "agent_error", "data": { "error_type": "timeout", "message": "...", "recoverable": true, "phase": "proposal" } }
{ "type": "vote", "data": { "vote": "...", "confidence": 0.72 } }
{ "type": "consensus", "data": { "reached": true, "confidence": 0.85, "answer": "...", "status": "consensus_reached", "agent_failures": {} } }
{ "type": "debate_end", "data": { "duration": 42.2, "rounds": 3 } }
Audience metrics emitted after user_vote look like:
{
"type": "audience_metrics",
"data": {
"votes": { "Option A": 3 },
"weighted_votes": { "Option A": 4.5 },
"suggestions": 1,
"total": 4,
"histograms": { "Option A": { "1": 0, "2": 1, "3": 0 } },
"conviction_distribution": { "1": 0, "2": 1, "3": 0 }
}
}
Agent Failure Tracking
Consensus events may include status and agent_failures:
status:consensus_reached,completed, orinsufficient_participationagent_failures: map of agent → list of failure records
Each failure record includes:
{
"phase": "proposal",
"error_type": "timeout",
"message": "Agent response was empty",
"provider": "openai",
"timestamp": 1732735053.123
}
Stream Event Types
Canonical event names are defined in aragora/events/types.py (the server re-exports them via aragora/server/stream/events.py).
The list below is the full StreamEventType catalog, grouped by the category comments in code (197 event types as of 2026-02-03).
Debate events
debate_startround_startagent_messagecritiquevoteconsensussynthesisdebate_end
Quick preview events (shown in first 5 seconds of debate initialization)
quick_classificationagent_previewcontext_preview
Token streaming events (for real-time response display)
token_starttoken_deltatoken_end
Nomic loop events
cycle_startcycle_endphase_startphase_endtask_starttask_completetask_retryverification_startverification_resultcommitbackup_createdbackup_restorederrorphase_timeoutlog_message
Multi-loop management events
loop_registerloop_unregisterloop_list
Audience participation events
user_voteuser_suggestionaudience_summaryaudience_metricsaudience_drain
Memory/learning events
memory_recallinsight_extractedmemory_storedmemory_retrieved
Ranking/leaderboard events (debate consensus feature)
match_recordedleaderboard_updategrounded_verdictmoment_detectedagent_elo_updatedagent_calibration_changedagent_fallback_triggered
Knowledge Mound events (cross-pollination)
knowledge_indexedknowledge_queriedmound_updatedknowledge_stalekm_batch
Belief Network events (bidirectional KM integration)
belief_convergedcrux_detected
KM Adapter sync events (bidirectional tracking)
km_adapter_forward_synckm_adapter_reverse_querykm_adapter_validation
RLM events (bidirectional KM integration)
rlm_compression_complete
Claim verification events
claim_verification_result
Memory tier events
memory_tier_promotionmemory_tier_demotion
Graph debate events (branching/merging visualization)
graph_node_addedgraph_branch_createdgraph_branch_merged
Position tracking events
flip_detected
Feature integration events (data flow from backends to panels)
trait_emergedrisk_warningevidence_foundcalibration_updategenesis_evolutiontraining_data_exportedselection_feedbackmemory_coordination
Rhetorical analysis events
rhetorical_observation
Trickster/hollow consensus events
hollow_consensustrickster_intervention
Human intervention breakpoint events
breakpointbreakpoint_resolved
Progress/heartbeat events (for detecting stalled debates)
heartbeatagent_errorphase_progress
Mood/sentiment events (Real-Time Debate Drama)
mood_detectedmood_shiftdebate_energy
Capability probe events (Adversarial Testing)
probe_startprobe_resultprobe_complete
Deep Audit events (Intensive Multi-Round Analysis)
audit_startaudit_roundaudit_findingaudit_cross_examaudit_verdict
Telemetry events (Cognitive Firewall)
telemetry_thoughttelemetry_capabilitytelemetry_redactiontelemetry_diagnostic
Gauntlet events (Adversarial Validation)
gauntlet_startgauntlet_phasegauntlet_agent_activegauntlet_attackgauntlet_findinggauntlet_probegauntlet_verificationgauntlet_riskgauntlet_progressgauntlet_verdictgauntlet_complete
Phase 2: Workflow Builder Events
workflow_createdworkflow_updatedworkflow_deletedworkflow_startworkflow_step_startworkflow_step_progressworkflow_step_completeworkflow_step_failedworkflow_step_skippedworkflow_transitionworkflow_checkpointworkflow_resumedworkflow_human_approval_requiredworkflow_human_approval_receivedworkflow_human_approval_timeoutworkflow_debate_startworkflow_debate_roundworkflow_debate_completeworkflow_memory_readworkflow_memory_writeworkflow_completeworkflow_failedworkflow_terminatedworkflow_metrics
Voice/Transcription events (Speech-to-Text and Text-to-Speech)
voice_startvoice_chunkvoice_transcriptvoice_endvoice_responsevoice_response_startvoice_response_endtranscription_queuedtranscription_startedtranscription_progresstranscription_completetranscription_failed
5.1 Approval Flow events
approval_requestedapproval_approvedapproval_rejectedapproval_timeoutapproval_auto_approved
5.1 Rollback events
rollback_point_createdrollback_executed
5.1 Verification events (improvement cycle)
improvement_cycle_startimprovement_cycle_verifiedimprovement_cycle_failedimprovement_cycle_complete
5.2 Continuous Learning events
learning_eventelo_updatedpattern_discoveredcalibration_updatedknowledge_decayed
5.3 Alert events
alert_createdalert_acknowledgedalert_resolvedalert_escalated
5.3 Trigger events
trigger_addedtrigger_removedtrigger_executedtrigger_scheduler_starttrigger_scheduler_stop
5.3 Monitoring events
trend_detectedanomaly_detectedmetric_recorded
Explainability Events (real-time explanation generation)
explainability_startedexplainability_factorsexplainability_counterfactualexplainability_provenanceexplainability_narrativeexplainability_complete
Workflow Template Events (template execution updates)
template_execution_startedtemplate_execution_progresstemplate_execution_steptemplate_execution_completetemplate_execution_failedtemplate_instantiated
Gauntlet Receipt Events (receipt lifecycle updates)
receipt_generatedreceipt_verifiedreceipt_exportedreceipt_sharedreceipt_integrity_failed
KM Resilience Events (real-time resilience status)
km_circuit_breaker_statekm_retry_exhaustedkm_cache_invalidatedkm_integrity_error
Connector Webhook Events (external service notifications)
connector_webhook_receivedconnector_pagerduty_incidentconnector_plaid_transaction_syncconnector_qbo_webhook
Selected Payload Examples
Explainability (2026-01-20)
Real-time events during explanation generation:
explainability_started- Explanation generation started for debateexplainability_factors- Contributing factors have been computedexplainability_counterfactual- Counterfactual scenario generatedexplainability_provenance- Decision provenance chain builtexplainability_narrative- Natural language narrative readyexplainability_complete- Full explanation ready
Example:
{
"type": "explainability_factors",
"data": {
"debate_id": "debate-123",
"factors_count": 8,
"top_factor": {
"name": "evidence_quality",
"contribution": 0.35
}
},
"timestamp": 1737356400.0
}
Workflow Templates (2026-01-20)
Template execution lifecycle events:
template_execution_started- Template execution begantemplate_execution_progress- Progress update (percentage, current step)template_execution_step- Individual step completedtemplate_execution_complete- Execution finished successfullytemplate_execution_failed- Execution failed with errortemplate_instantiated- New template created from pattern
Example:
{
"type": "template_execution_progress",
"data": {
"execution_id": "exec-456",
"template_id": "security/code-review",
"progress_pct": 45,
"current_step": "vulnerability_scan",
"steps_completed": 3,
"steps_total": 7
},
"timestamp": 1737356400.0
}
Gauntlet Receipts (2026-01-20)
Receipt lifecycle events:
receipt_generated- New receipt generated for completed gauntletreceipt_verified- Receipt integrity successfully verifiedreceipt_exported- Receipt exported to format (json/html/md/sarif)receipt_shared- Shareable link created for receiptreceipt_integrity_failed- Receipt integrity verification failed
Example:
{
"type": "receipt_generated",
"data": {
"receipt_id": "receipt-789",
"debate_id": "debate-123",
"verdict": "pass",
"confidence": 0.92,
"hash": "sha256:a1b2c3..."
},
"timestamp": 1737356400.0
}
KM Resilience (2026-01-20)
Real-time resilience status events:
km_circuit_breaker_state- Circuit breaker state changedkm_retry_exhausted- All retries exhausted for operationkm_cache_invalidated- Cache was invalidatedkm_integrity_error- Data integrity error detected
Example:
{
"type": "km_circuit_breaker_state",
"data": {
"service": "postgres",
"state": "open",
"previous_state": "closed",
"failures": 5,
"recovery_at": "2026-01-20T11:30:00Z"
},
"timestamp": 1737356400.0
}
Some events are emitted only when the corresponding feature is enabled. Use
loop_list and sync control messages to seed UI state before processing
stream events.
Control Plane Stream
The control plane provides a separate WebSocket stream for agent orchestration and task lifecycle events. This is useful for monitoring dashboards and coordination UIs.
Endpoint
ws://localhost:8766/api/control-plane/stream
ws://localhost:8766/ws/control-plane
Connection Flow
On connection, the server sends a connected event:
{
"type": "connected",
"timestamp": 1732735053.123,
"data": {
"message": "Connected to control plane stream"
}
}
Agent Events
Events related to agent lifecycle and status:
agent_registered
Emitted when an agent registers with the control plane.
{
"type": "agent_registered",
"timestamp": 1732735053.123,
"data": {
"agent_id": "agent-abc123",
"capabilities": ["debate", "critique", "summarize"],
"model": "claude-3-opus",
"provider": "anthropic"
}
}
agent_unregistered
Emitted when an agent unregisters or is removed.
{
"type": "agent_unregistered",
"timestamp": 1732735053.123,
"data": {
"agent_id": "agent-abc123",
"reason": "graceful_shutdown"
}
}
agent_status_changed
Emitted when an agent's status changes (idle, busy, etc.).
{
"type": "agent_status_changed",
"timestamp": 1732735053.123,
"data": {
"agent_id": "agent-abc123",
"old_status": "idle",
"new_status": "busy"
}
}
agent_heartbeat
Periodic heartbeat from an agent.
{
"type": "agent_heartbeat",
"timestamp": 1732735053.123,
"data": {
"agent_id": "agent-abc123",
"status": "idle",
"tasks_completed": 42
}
}
agent_timeout
Emitted when an agent fails to send heartbeats within the expected interval.
{
"type": "agent_timeout",
"timestamp": 1732735053.123,
"data": {
"agent_id": "agent-abc123",
"last_heartbeat": 1732734053.123
}
}
Task Events
Events related to task lifecycle:
task_submitted
Emitted when a new task is submitted to the scheduler.
{
"type": "task_submitted",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"task_type": "debate",
"priority": "high",
"required_capabilities": ["debate", "critique"]
}
}
task_claimed
Emitted when an agent claims a task.
{
"type": "task_claimed",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"agent_id": "agent-abc123"
}
}
task_started
Emitted when an agent begins executing a task.
{
"type": "task_started",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"agent_id": "agent-abc123"
}
}
task_completed
Emitted when a task completes successfully.
{
"type": "task_completed",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"agent_id": "agent-abc123",
"result_summary": "Debate concluded with consensus..."
}
}
task_failed
Emitted when a task fails.
{
"type": "task_failed",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"agent_id": "agent-abc123",
"error": "Agent timeout during execution",
"retries_left": 2
}
}
task_cancelled
Emitted when a task is cancelled.
{
"type": "task_cancelled",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"reason": "user_requested"
}
}
task_retrying
Emitted when a failed task is being retried.
{
"type": "task_retrying",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"attempt": 2,
"max_attempts": 3
}
}
task_dead_lettered
Emitted when a task exhausts retries and is moved to the dead letter queue.
{
"type": "task_dead_lettered",
"timestamp": 1732735053.123,
"data": {
"task_id": "task-xyz789",
"reason": "Max retries exceeded"
}
}
System Events
Events related to system health and metrics:
health_update
Periodic system health status.
{
"type": "health_update",
"timestamp": 1732735053.123,
"data": {
"status": "healthy",
"agents": {
"total": 5,
"idle": 3,
"busy": 2
}
}
}
metrics_update
System metrics update.
{
"type": "metrics_update",
"timestamp": 1732735053.123,
"data": {
"tasks_per_minute": 12.5,
"avg_task_duration": 4.2,
"queue_depth": 8
}
}
scheduler_stats
Detailed scheduler statistics.
{
"type": "scheduler_stats",
"timestamp": 1732735053.123,
"data": {
"pending_tasks": 15,
"running_tasks": 4,
"completed_today": 342,
"failed_today": 3,
"avg_wait_time": 1.2
}
}
Error Events
error
System error notification.
{
"type": "error",
"timestamp": 1732735053.123,
"data": {
"error": "Redis connection lost",
"context": {
"component": "scheduler",
"retry_in": 5
}
}
}
Client Messages
Clients can send the following messages to the control plane stream:
Ping
Keep-alive ping:
{ "type": "ping" }
Server responds with:
{ "type": "pong", "timestamp": 1732735053.123 }
Subscribe (Future)
Subscribe to specific event types (not yet implemented):
{
"type": "subscribe",
"events": ["task_completed", "task_failed"]
}
Example: JavaScript Client
const ws = new WebSocket('ws://localhost:8766/api/control-plane/stream');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
switch (data.type) {
case 'agent_registered':
console.log(`Agent ${data.data.agent_id} joined`);
break;
case 'task_completed':
console.log(`Task ${data.data.task_id} completed`);
break;
case 'task_failed':
console.error(`Task ${data.data.task_id} failed: ${data.data.error}`);
break;
case 'health_update':
updateDashboard(data.data);
break;
}
};
// Keep connection alive
setInterval(() => {
ws.send(JSON.stringify({ type: 'ping' }));
}, 30000);