Swarm Monitor
Aggregate health grid showing throughput, tokens, and global controls.
Install
npx ax-depute@latest add swarm-monitorpnpm dlx ax-depute@latest add swarm-monitoryarn dlx ax-depute@latest add swarm-monitorbunx ax-depute@latest add swarm-monitorOverview
A macro-level dashboard header. It aggregates the operating health of the entire swarm into a single row of KPIs, and features a prominent "global kill switch" for emergency overrides. Use this alongside Agent Roster for per-agent drill-downs.
Basic usage
import { SwarmMonitor } from '@/components/SwarmMonitor';
export function App() {
const currentMetrics = {
activeInstances: 14,
idleInstances: 3,
totalCost: '$1.42',
tokensBurned: 145000,
errorRate: 12, // 12%
taskCompletionRate: 68, // 68%
estimatedTimeRemaining: '~4m'
};
return (
<div className="p-4 border border-zinc-200 dark:border-zinc-800 rounded-lg">
<SwarmMonitor
metrics={currentMetrics}
onGlobalPause={() => console.log('Swarm paused')}
onGlobalKill={() => console.log('Swarm killed')}
/>
</div>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
metrics | Object | Required | Aggregate metrics object displaying the health of the entire swarm (see Type below). |
onGlobalPause | () => void | undefined | Callback fired when the user clicks the "Pause All" action. |
onGlobalKill | () => void | undefined | Callback fired when the user clicks the "Halt Swarm" emergency kill switch. |
className | string | undefined | Additional CSS class for the root element. |
Types
SwarmMetrics
export interface SwarmMonitorProps {
metrics: {
activeInstances: number; // Currently running agents
idleInstances: number; // Agents waiting for routing/input
totalCost: string; // Formatted USD string e.g. "$1.42"
tokensBurned: number; // Raw input+output token count
errorRate: number; // Percentage 0–100. Colors amber > 5%, red > 15%
taskCompletionRate?: number; // Percentage 0–100. Renders as a progress bar
estimatedTimeRemaining?: string;
};
}Composition flow
Swarm Monitor is the apex header of a multi-agent dashboard.
- Render it at the very top of complex pages to provide aggregate situational awareness.
- Pair it with Agent Roster (for flat worker pools) or Orchestrator View (for hierarchical delegation trees) beneath it so users can drill into the specific agents causing the error rates reported in the monitor.
- If the monitor shows a high error spike, the user clicks the prominent
onGlobalKillbutton to halt the entire system at once.
Design rationale
1. The "Big Red Button" at Scale
While Run Controls stops a single agent, Swarm Monitor controls the fleet. When an unexpected loop or hallucination cascade begins, supervisors do not have time to find the specific rogue agent. The onGlobalKill action provides instant peace of mind.
2. Visualizing Severity (The 15% Rule)
The errorRate metric is not a static number; it is a dynamic severity indicator. By default, it tints Amber if the error rate exceeds 5%, and solid Red if it exceeds 15% (the point at which a generative swarm is likely caught in a retry loop).
3. Progress vs. Time
Generative workflows are non-deterministic, making time estimates notoriously inaccurate. Swarm Monitor centers the taskCompletionRate (a deterministic ratio of pending vs completed tasks) rather than a shaky countdown clock, grounding the human in reality.