Introducing anfra: governed BI apps, built by your coding agent
anfra is an open-source framework for building custom BI apps with coding agents, where every number comes from metrics your data team defines
Today we're open-sourcing anfra, a framework for building custom BI apps with your coding agent on a governed semantic foundation. Your data team defines metrics once, in code, and reviews every change. Every app your agent builds queries those metrics, and every number traces back to its definition and the SQL that ran.
Trust or freedom: until now, you had to pick one
BI tools give you numbers you can trust. They keep numbers consistent because your data team models every metric. The catch is that you can only build what their charts, filters and layouts allow.
Coding agents give you freedom. Claude Code, Codex or Cursor can build any app you describe. But when an agent queries raw tables, it decides what each metric means and writes new SQL for every app. Three things go wrong:
- Calculations can be wrong. An agent can average a rate that should be recomputed, or join a table that double-counts a fee. The chart still renders, so nobody notices.
- Apps disagree with each other. Each new app defines revenue a little differently. After a few months, two apps show two different totals and nobody knows which one is right.
- Nobody can check the logic. When the logic lives inside each app's code, a reviewer can't easily see which definition a number used, or reuse it in the next app.
With anfra, the agent still builds any app you ask for, and every number goes through metrics your data team defines.
Your data team decides what "revenue" means
Writing metric definitions into a prompt doesn't make an agent follow them. In anfra, metrics are code that compiles to SQL, so every app that uses revenue gets the same calculation.
Dataset sales {
metric revenue {
definition: @aql sum(orders.amount) ;;
}
}Your agent drafts models and metrics, and your team reviews them like any other code change. Apps query metrics through the SDK and never edit the model.
The agent builds the page. The semantic layer computes the numbers.
anfra sits between your app and your semantic layer. Apps don't contain SQL. They ask for metrics by name, and anfra turns each request into a query on the metrics your semantic layer defines. There are three parts:
- anfra SDK. A JavaScript library your app uses to request data and wire up filters, drill-downs and period comparisons, by dataset and metric name.
- anfra Server. Turns each interaction into a query on your semantic layer, runs it on your warehouse and returns the results. It also serves MCP, so coding agents can read your models.
- Your semantic layer. Your models, datasets and metrics, defined as code. anfra ships with AMQL built in, so you can start without one. Support for dbt, Cube, Snowflake and Databricks semantic layers (opens in a new tab) is planned.
Here is a page with revenue by region and a monthly trend, where a click on a region filters the trend:
const byRegion = app.createQuery('byRegion', {
dataset: 'sales',
aql: `explore {
dimensions { region: users.region }
measures { revenue: revenue }
}`,
})
const trend = app.createQuery('trend', {
dataset: 'sales',
aql: `explore {
dimensions { month: date_trunc(orders.created_at, 'month') }
measures { revenue: revenue }
}`,
})
app.mapCrossFilter(byRegion, trend)When someone clicks "APAC", anfra filters the trend query and runs this on your warehouse. The page never wrote it, and revenue means the same thing in every app.
SELECT date_trunc('month', orders.created_at) AS month,
SUM(orders.amount) AS revenue
FROM orders
JOIN users ON orders.user_id = users.id
WHERE users.region = 'APAC'
GROUP BY 1Inspect any number
Every app you build with anfra has Inspect built in. Open it on any chart to see the metric definitions behind a number and the exact SQL that ran on your warehouse. A reviewer doesn't have to read the app's code to trust what it shows.
Open source today, anfra Cloud next
anfra is free under the Apache License 2.0. Your models and apps are plain files in your own repository, and it doesn't need a Holistics account. Queries run on your warehouse, and anfra doesn't include an AI model, so you bring your own coding agent.
We're also building anfra Cloud, a hosted version for teams that need logins, SSO, row-level permissions, sharing links and audit logs. A project you build with open-source anfra will run unchanged on anfra Cloud. See pricing for what's in each.
Build your first app in about 10 minutes
anfra runs locally as a single binary for Linux and macOS:
curl -fsSL https://anfra.ai/install.sh | bash
anfra skills install
anfra init my-projectAdd your warehouse credentials to .anfra/data_sources.yml, open the project in your coding agent and ask for an app:
Use the build-data-app skill. Build a revenue overview with a region filter.
Then run anfra serve and open Inspect on any number. The quickstart (opens in a new tab) walks through every step, and the live demos (opens in a new tab) show what agents have built so far. We'd love your feedback on GitHub (opens in a new tab).