1. Event contract
One row in agent_events, with the types used by the query made explicit.
- timestamp_utc
- Timestamp
- event_name
- Utf8
- data.tool_name
- Utf8
- data.status
- Utf8
- data.args.operation
- Utf8
- data.latency_ms
- Float64
Use table metadata and a focused prompt to get a first DataFusion query or visualization plan, then review the generated logic against the schema and real result.
Outcomes
How it works
Name the table, metric definition, time range, grouping, and expected output. Ambiguous business language produces ambiguous SQL.
Check field types, joins, denominators, null handling, and time boundaries before trusting the chart.
Use AI for acceleration, not authority. A saved query should be understandable by the next human or agent that maintains it.
Generating an editable query with AI
A real product capture showing a plain-language question becoming SQL that remains visible for review.
Boundaries
Inspectable proof path
This example uses a declared schema, read-only SQL, and deterministic synthetic results. It demonstrates the workflow without presenting sample data as a customer benchmark.
One row in agent_events, with the types used by the query made explicit.
Which AI tools and arguments are associated with the most failed calls?
SELECT
"data.tool_name" AS tool_name,
"data.args.operation" AS operation,
COUNT(*) AS calls,
SUM(CASE
WHEN "data.status" = 'failed' THEN 1 ELSE 0
END) AS failures,
100.0 * SUM(CASE
WHEN "data.status" = 'failed' THEN 1 ELSE 0
END) / NULLIF(COUNT(*), 0) AS failure_rate_pct,
approx_percentile_cont("data.latency_ms", 0.95) AS p95_latency_ms
FROM agent_events
WHERE event_name = 'agent_tool_called'
AND timestamp_utc >= now() - INTERVAL '7 days'
GROUP BY "data.tool_name", "data.args.operation"
HAVING COUNT(*) >= 20
ORDER BY failure_rate_pct DESC, calls DESC;CRM lookup is both the least reliable tool operation and the slowest at p95.
| tool_name | operation | calls |
|---|---|---|
| crm_lookup | search_contact | 842 |
| order_api | fetch_order | 2210 |
| knowledge_search | semantic_search | 4510 |
Capabilities
Documentation
See the analysis
Filter dotted nested fields and rank failing tools without flattening the original event payload.
Open recipeConnect model spend to accepted, saved, or otherwise useful product outcomes.
Open recipeGroup users by first activity week and measure the percentage returning in later weeks.
Open recipeCustomer evidence
Related capabilities
Structured event ingestion
SQL workbench and Query API
Explore
Use a focused prompt, send synthetic events, and verify the first useful query before expanding coverage.