Anfra docs
Getting Started

Introduction

What Anfra is and what you can build with it

Anfra is infrastructure for agentic analytics — what AI agents query instead of guessing SQL. It's free, self-hosted, CLI-first, and developer-led.

By grounding agents in a governed semantic layer, Anfra makes their answers trustworthy (auditable, not hallucinated), capable (they can answer real business questions), and efficient (no re-deriving logic every query).

The resolution chain looks like this:

natural language → semantic resolution → AMQL → deterministic SQL → auditable answer

Why a semantic layer

  • Consistency — a metric like "Revenue" is defined once, so every agent and dashboard that uses it agrees.
  • Reusability — data models and datasets are composed once and reused everywhere, instead of every query reinventing the same joins.
  • Governance — business logic lives in version-controlled files, not scattered across chat threads and one-off SQL.

Core concepts

An Anfra project is built from four building blocks, covered in Concepts:

  • Data Models — map a table or SQL query in your warehouse into dimensions and measures.
  • Datasets — combine data models and their relationships into a single queryable view.
  • Metrics — named, reusable calculations such as Total Revenue or Active Users.
  • Dimensions — attributes you group and filter metrics by, such as Order Date or Country.

Who it's for

Built primarily for analytics engineers and dbt users who already work in code, git, and SQL — teams that want to codify business context once and have both AI agents and dashboards query the same governed definitions.

Next steps

On this page