Channels
| Channel | What Gets Published |
|---|---|
agents | Phase changes, spawned, stopped, errors, heartbeats, directives |
hive | Proposal verdicts, capital allocated, agents spawned/killed |
risk | Circuit breaker triggered, drawdown alerts, risk limit hits |
knowledge | Insights shared between agents, discoveries |
system | Status updates, metrics, startup/shutdown |
ui | User commands forwarded from external clients |
Usage
Ring Buffers
Each channel keeps the last 1,000 events in a ring buffer. Late-connecting clients can request history:Client Protocol
Clients connect via WebSocket tows://host:port. On connect, automatically subscribed to all channels. They can manage subscriptions and send commands:
command are forwarded to the hive channel as HIVE_DIRECTIVE events. The Hive picks them up on its next oversight cycle.
Event Format
Every event follows theSwarmEvent structure:
Event Types
| Type | Channel | When |
|---|---|---|
agent_spawned | agents | Agent created by AgentFactory |
agent_promoted | agents | Agent moved paper to shadow to live |
agent_culled | agents | Agent removed by SwarmCoordinator |
agent_phase_changed | agents | Agent transitions to new phase |
agent_stopped | agents | Agent finished or errored |
order_submitted | agents | Agent places an order |
fill_received | agents | Order matched |
position_opened | agents | New position created |
position_closed | agents | Position fully closed |
pheromone_deposit | hive | Agent deposits pheromone signal |
consensus_update | hive | ConsensusEngine view updated |
capital_rebalanced | hive | SwarmCoordinator reallocated capital |
evolution_complete | hive | EvolutionEngine finished a generation |
autonomy_graduated | hive | AutonomyController promoted to new mode |
circuit_breaker_triggered | risk | Hard limit breached, emergency stop |
criticality_alert | risk | CriticalityMonitor detected systemic risk |
kill_chain_triggered | risk | KillChain incident response started |
kill_chain_phase | risk | KillChain advanced to next phase |
drawdown_alert | risk | Drawdown approaching limit |
knowledge_shared | knowledge | Agent shared insight to knowledge graph |
causal_edge_detected | knowledge | CausalEngine found new relationship |
heartbeat | agents | Periodic agent state snapshot |
metrics_update | system | Hive oversight cycle metrics |
system_status | system | Startup, shutdown, status change |
Thread Safety
The event bus runs as an asyncio WebSocket server. Agents and the Hive publish from the async event loop usingawait bus.publish(). The circuit breaker and engine callbacks run in threads, so they use bus.publish_sync() which calls asyncio.run_coroutine_threadsafe() to cross the thread/async boundary safely.