Watch
0
0
Fork
You've already forked hyperhive
0

agents board: a turns tab, and turn duration bounds past 10 s

The per-agent /stats page shows what the swarm agents board lacked about
turns. The new tab reads the turn count and duration the harness already
records: average duration, cache hit rate, tokens per turn, turns per hour
by agent and by model, duration percentiles, and the wake source and result
mixes. The duration histogram used the SDK default buckets, which stop at
10 s while a turn averages 24 s, so every p95 read a flat 10 s; it now has
explicit bounds up to an hour.
This commit is contained in:
iris 2026-11-03 00:16:47 +01:00
commit aecde1dc75

View file

@ -2623,6 +2623,701 @@
}
}
}
},
"panel-69": {
"kind": "Panel",
"spec": {
"id": 69,
"title": "Average turn duration",
"description": "Mean wall-clock time of a turn in the selected range, as the harness measures it.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sum(increase({__name__=\"hyperhive.agent.turn.duration_sum\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])) / sum(increase({__name__=\"hyperhive.agent.turn.duration_count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
"instant": true,
"legendFormat": "Average turn duration"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"textMode": "value"
},
"fieldConfig": {
"defaults": {
"unit": "ms",
"decimals": 0,
"color": {
"mode": "fixed",
"fixedColor": "text"
}
},
"overrides": []
}
}
}
}
},
"panel-70": {
"kind": "Panel",
"spec": {
"id": 70,
"title": "Cache hit rate",
"description": "Cached input over all input-side tokens (input, cache reads and cache writes) in the selected range.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sum(increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=\"cacheRead\"}[$__range])) / sum(increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=~\"input|cacheRead|cacheCreation\"}[$__range]))",
"instant": true,
"legendFormat": "Cache hit rate"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"textMode": "value"
},
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"decimals": 1,
"color": {
"mode": "fixed",
"fixedColor": "text"
}
},
"overrides": []
}
}
}
}
},
"panel-71": {
"kind": "Panel",
"spec": {
"id": 71,
"title": "Tokens per turn",
"description": "Tokens of every type, subagents included, divided by turns in the selected range.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sum(increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])) / sum(increase({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
"instant": true,
"legendFormat": "Tokens per turn"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"textMode": "value"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0,
"color": {
"mode": "fixed",
"fixedColor": "text"
}
},
"overrides": []
}
}
}
}
},
"panel-72": {
"kind": "Panel",
"spec": {
"id": 72,
"title": "Turns per hour by agent",
"description": "How many turns each agent runs per hour.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sum by (agent) (rate({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__rate_interval])) * 3600",
"legendFormat": "{{agent}}"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {
"interval": "10m"
}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "timeseries",
"version": "",
"spec": {
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"color": {
"mode": "palette-classic"
},
"custom": {
"axisSoftMin": 0,
"drawStyle": "line",
"fillOpacity": 0,
"lineWidth": 1,
"showPoints": "never",
"spanNulls": false
}
},
"overrides": []
}
}
}
}
},
"panel-73": {
"kind": "Panel",
"spec": {
"id": 73,
"title": "Turns per hour by model",
"description": "Turns per hour by the model that ran them; the model drives the token cost.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sum by (model) (rate({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__rate_interval])) * 3600",
"legendFormat": "{{model}}"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {
"interval": "10m"
}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "timeseries",
"version": "",
"spec": {
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 1,
"color": {
"mode": "palette-classic"
},
"custom": {
"axisSoftMin": 0,
"drawStyle": "line",
"fillOpacity": 0,
"lineWidth": 1,
"showPoints": "never",
"spanNulls": false
}
},
"overrides": []
}
}
}
}
},
"panel-74": {
"kind": "Panel",
"spec": {
"id": 74,
"title": "Turn duration",
"description": "Median, 95th percentile and mean turn duration.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "histogram_quantile(0.5, sum by (le) (rate({__name__=\"hyperhive.agent.turn.duration_bucket\", hive=~\"$hive\", agent=~\"$agent\"}[$__rate_interval])))",
"legendFormat": "p50"
}
},
"refId": "A",
"hidden": false
}
},
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "histogram_quantile(0.95, sum by (le) (rate({__name__=\"hyperhive.agent.turn.duration_bucket\", hive=~\"$hive\", agent=~\"$agent\"}[$__rate_interval])))",
"legendFormat": "p95"
}
},
"refId": "B",
"hidden": false
}
},
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sum(rate({__name__=\"hyperhive.agent.turn.duration_sum\", hive=~\"$hive\", agent=~\"$agent\"}[$__rate_interval])) / sum(rate({__name__=\"hyperhive.agent.turn.duration_count\", hive=~\"$hive\", agent=~\"$agent\"}[$__rate_interval]))",
"legendFormat": "mean"
}
},
"refId": "C",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {
"interval": "10m"
}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "timeseries",
"version": "",
"spec": {
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"fieldConfig": {
"defaults": {
"unit": "ms",
"decimals": 0,
"color": {
"mode": "palette-classic"
},
"custom": {
"axisSoftMin": 0,
"drawStyle": "line",
"fillOpacity": 0,
"lineWidth": 1,
"showPoints": "never",
"spanNulls": false
}
},
"overrides": []
}
}
}
}
},
"panel-75": {
"kind": "Panel",
"spec": {
"id": 75,
"title": "Wake source mix",
"description": "What woke the turns in the selected range: a peer, the operator, a reminder, a todo or the system.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sort_desc(sum by (wake_from) (increase({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
"instant": true,
"legendFormat": "{{wake_from}}"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "bargauge",
"version": "",
"spec": {
"options": {
"displayMode": "basic",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"showUnfilled": true,
"valueMode": "text"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": null,
"color": "blue"
}
]
},
"color": {
"mode": "fixed",
"fixedColor": "blue"
}
},
"overrides": []
}
}
}
}
},
"panel-76": {
"kind": "Panel",
"spec": {
"id": 76,
"title": "Result mix",
"description": "How the turns in the selected range ended, as the harness classifies them.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sort_desc(sum by (result_kind) (increase({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
"instant": true,
"legendFormat": "{{result_kind}}"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "bargauge",
"version": "",
"spec": {
"options": {
"displayMode": "basic",
"orientation": "horizontal",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"showUnfilled": true,
"valueMode": "text"
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": null,
"color": "blue"
}
]
},
"color": {
"mode": "fixed",
"fixedColor": "blue"
}
},
"overrides": []
}
}
}
}
},
"panel-77": {
"kind": "Panel",
"spec": {
"id": 77,
"title": "Turns that did not end ok",
"description": "Turns per hour that ended in anything but ok: compacted, failed or an API stall.",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "@datasourceUid@"
},
"spec": {
"expr": "sum by (result_kind) (rate({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\", result_kind!=\"ok\"}[$__rate_interval])) * 3600",
"legendFormat": "{{result_kind}}"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {
"interval": "10m"
}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "timeseries",
"version": "",
"spec": {
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"fieldConfig": {
"defaults": {
"unit": "short",
"decimals": 2,
"color": {
"mode": "palette-classic"
},
"custom": {
"axisSoftMin": 0,
"drawStyle": "bars",
"fillOpacity": 60,
"lineWidth": 1,
"showPoints": "never",
"spanNulls": false
}
},
"overrides": []
}
}
}
}
}
},
"layout": {
@ -2733,6 +3428,136 @@
}
}
},
{
"kind": "TabsLayoutTab",
"spec": {
"title": "turns",
"layout": {
"kind": "GridLayout",
"spec": {
"items": [
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 0,
"width": 8,
"height": 4,
"element": {
"kind": "ElementReference",
"name": "panel-69"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 8,
"y": 0,
"width": 8,
"height": 4,
"element": {
"kind": "ElementReference",
"name": "panel-70"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 16,
"y": 0,
"width": 8,
"height": 4,
"element": {
"kind": "ElementReference",
"name": "panel-71"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 4,
"width": 12,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-72"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 12,
"y": 4,
"width": 12,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-73"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 12,
"width": 24,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-74"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 20,
"width": 8,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-75"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 8,
"y": 20,
"width": 8,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-76"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 16,
"y": 20,
"width": 8,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-77"
}
}
}
]
}
}
}
},
{
"kind": "TabsLayoutTab",
"spec": {