Event contract
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | Terminal agent-run time in UTC. |
| workflow | Utf8 | Stable product workflow or task category. |
| model | Utf8 | Model identifier recorded from the provider response. |
| status | Utf8 | success or failed for the technical run. |
| reviewer_outcome | Utf8 | accepted, revised, rejected, or not_reviewed. |
| human_handoff | Boolean | Whether a human took over the task. |
| duration_ms | Float64 | End-to-end workflow duration. |
| estimated_cost_usd | Float64 | Normalized estimated model cost for the run. |
Copy the query
SELECT
workflow,
model,
COUNT(*) AS runs,
100.0 * SUM(CASE WHEN status = 'success' THEN 1 ELSE 0 END)
/ NULLIF(COUNT(*), 0) AS technical_success_rate_pct,
100.0 * SUM(CASE WHEN reviewer_outcome = 'accepted' THEN 1 ELSE 0 END)
/ NULLIF(SUM(CASE
WHEN reviewer_outcome <> 'not_reviewed' THEN 1 ELSE 0
END), 0) AS reviewed_acceptance_rate_pct,
100.0 * SUM(CASE WHEN human_handoff THEN 1 ELSE 0 END)
/ NULLIF(COUNT(*), 0) AS human_handoff_rate_pct,
AVG(duration_ms) AS average_duration_ms,
SUM(estimated_cost_usd) / NULLIF(COUNT(*), 0) AS cost_per_run_usd
FROM agent_run_outcomes
WHERE timestamp_utc >= now() - INTERVAL '30 days'
GROUP BY workflow, model
HAVING COUNT(*) >= 20
ORDER BY reviewed_acceptance_rate_pct, runs DESC;This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. The deterministic sample output is synthetic and reviewed separately; validate field types, thresholds, and business definitions against your own data. Read the testing methodology.
Query result
Reviewed agent acceptance by workflow
Refund review completes technically but needs substantially more revision or human takeover than the other workflows.
| workflow | model | runs | technical_success_rate_pct | reviewed_acceptance_rate_pct | human_handoff_rate_pct | average_duration_ms | cost_per_run_usd |
|---|---|---|---|---|---|---|---|
| support_triage | configured-model-a | 1,840 | 98.1 | 86.4 | 18.2 | 4,820 | 0.04 |
| refund_review | configured-model-b | 620 | 96.8 | 68.7 | 42.9 | 8,110 | 0.07 |
| knowledge_draft | configured-model-a | 940 | 99.2 | 91.6 | 8.4 | 3,910 | 0.04 |
Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.
Reproduce the example
Download the public fixture
The JSON bundle includes the typed event contract, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.
How the SQL works
- 1Technical success and reviewed acceptance remain separate so a completed API call cannot stand in for product quality.
- 2The acceptance denominator excludes unreviewed runs rather than silently treating missing labels as rejection.
- 3Handoff, duration, and cost expose the operational tradeoff behind an apparently high completion rate.
Edge cases to decide
- Reviewer outcomes need a stable rubric and inter-rater checks before comparing teams or model versions.
- Automatically resolved easy tasks can bias acceptance upward; segment by task difficulty when it changes.
- Keep raw prompts, completions, and sensitive tool results out of the event unless explicitly approved.
Recommended dashboard
- Bars: reviewed acceptance and human handoff by workflow
- Trend: acceptance after model or prompt releases
- Table: runs grouped by controlled reviewer outcome
Alert guidance
Review mature cohorts when acceptance drops or handoff rises after a release; page only for a user-facing failure or safety boundary.
Read alert setupPut the recipe to work
Related instrumentation and guides
Continue the analysis
Calculate LLM Cost by Feature and Model
Attribute model spend, tokens, request volume, and cost per request to product features.
Open recipeMeasure Accepted AI Outputs per Dollar
Connect model spend to accepted, saved, or otherwise useful product outcomes.
Open recipeMeasure LLM Cache Savings and Retry Cost
Compare cached requests, retry volume, and estimated spend by model to find avoidable AI cost.
Open recipeRun it on real events
Create a table, adapt the fields, and save the result
Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.