Skip to documentation
Reference

Query DSL

All analysis goes through a typed Query DSL — a discriminated union on kind. Branches reference registered metric keys, never raw SQL. There is no SQL surface exposed to clients, which is exactly what keeps an agent's output safe.

Query types

kindquestion
trendhow much of X over time (with optional breakdown)
funnelwhat share go from A to B, in order
retentiondo users come back after doing X
lifecyclenew / returning / resurrecting / dormant under the total
stickinesshow habitual is the product
entitieswhich entities are currently in state S

Example

query_trend({
  metric: "checkout_completed",
  date_from: "-30d",
  interval: "week",
  breakdown: "plan"
})

Right-censoring

Retention and lifecycle are honest about partial windows: recent cohorts expose mature_periods, and the latest, still-open interval is never counted as churn. Read the most recent bucket with that in mind.

Dates

Accept relative (-30d, -12w) or ISO. Don't hand-compute timestamps.