Method
Repeated identical prompts against the live stack, median of N, on the box. A turn is a
POST /ui/chat followed by a poll loop until the run stops polling, so the numbers include the
model, the tool calls and the persistence — not just the HTTP hop.
Result
| Turn | Before | After prompt/output work |
|---|---|---|
| simple recall | 2.4–3.4 s (swings to 11 s for the same prompt) | ~5.9 s — provider variance dominates, no gain claimed |
| chart spec | 18.4 s | 8.8 s |
| HTML dashboard | 86.5 s, 8,877-char artifact | 35–61 s, median ~48 s, ~2,200-char artifact |
POST /ui/chat itself, after async runs |
— | 0.02 s (was the whole turn) |
What the numbers rule out
- MCP tool execution is not the cost: p50 0.1 ms, p95 6 ms.
- Context replay is not the cost: 432 tokens for a four-message thread.
- Output length is the cost: artifacts were kilobytes at ~50 tok/s, which is why capping artifact size moved the dashboard turn by ~40 s.
What did not work
max_tokens is ignored by the API server: 40 and 400 both produced 1,068 completion tokens
with finish_reason: stop. The knob was removed from the code rather than left as decoration.
Output is bounded by instructing the model (artifact caps, no comments, prefer a chart spec over
raw HTML), and by making the wait legible — see the streaming states in the run bubble.
Rendered from nx-master/metrics/agent-latency.md · OKF bundle · regenerate with npm run render