opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

WrenAI gives AI agents a governed semantic layer for trustworthy text-to-SQL
GitHub RepoImpressions3

Project Description

View on GitHub

Give Your AI Agents a Context Layer They Can Actually Trust

You've probably watched an AI agent generate a SQL query that looks perfect—until you notice it joined the wrong table, used the wrong definition of "revenue," or confidently answered with data from last quarter. The problem isn't the model; it's that schemas don't carry business context. That's the gap WrenAI steps into: an open-source generative BI engine that gives AI agents a governed semantic layer, so text-to-SQL stops being a guessing game.

What It Does

WrenAI is a generative BI (GenBI) engine that lets AI agents generate, deploy, and govern business intelligence across 22+ data sources. At its core, it's a text-to-SQL platform wrapped in a semantic layer that agents can actually reason over.

The key architectural piece is the MDL (semantic model)—a versionable, evidence-linked file format that captures business semantics, approved definitions, examples, and company knowledge. This sits alongside an AI context layer that pulls in unstructured information from your docs, wikis, and chat threads. The result is that agents don't just see raw tables; they see the meaning behind them.

The engine itself is powered by wren-core-wasm, which compiles the core logic to WebAssembly. That means dashboards can run entirely in the browser—no server-side compute required for rendering. The project recently merged the Wren Engine into this repo under core/, consolidating the semantic layer and the GenBI application into a single codebase.

Why It's Cool

The interesting part isn't just that WrenAI does text-to-SQL—lots of projects do that. What stands out is how it approaches correctness and governance:

  • It's built for agents, not just chat. The README explicitly positions this as a platform for "every agent you already run." The context layer is designed to be reusable across different AI agents, not locked into a single chat UI.

  • It validates before it executes. The pipeline includes "dry-plan validation" and "structured errors." That means the system checks the SQL plan before running it, which catches a whole class of mistakes that typically slip through in naive text-to-SQL implementations.

  • Context is versionable and reviewable. The semantic models, company definitions (instructions.md), and memory of what worked are all stored as files. That's a huge deal for teams that need to audit why an agent made a particular decision. You can diff changes, review updates, and roll back if something breaks.

  • It's Git-friendly by design. Because everything lives in files, you can version-control your semantic layer like you version-control your code. No more black-box configuration stored in a database somewhere.

  • Deployment is one command. The README mentions you can ship a dashboard to your own Vercel or Cloudflare Pages account with a single command. The browser-side rendering via wasm means you don't need to maintain a separate backend for serving dashboards.

  • The legacy path is preserved. The previous chat-first BI product is preserved on the legacy/v1 branch as "Wren GenBI Classic." That's a thoughtful approach to evolution—they're not breaking existing users while they build the next generation.

How to Try It

The project is available under the Apache 2.0 license, and there's a PyPI package if you want to install it directly:

pip install wrenai

But the full experience involves running the engine and connecting it to your data sources. Here's the general flow:

  1. Head to the repository at github.com/canner/wrenai and check the README for the latest setup instructions.
  2. Review the docs at docs.getwren.ai for detailed guidance on defining your semantic models and connecting data sources.
  3. Define your MDL files—this is where you encode business definitions, approved metrics, and examples. This is the foundation your agents will rely on.
  4. Connect your data source from the 22+ supported options.
  5. Ask a question through your agent or the provided interface, and watch it generate SQL grounded in your semantic layer.

If you're coming from the old WrenAI chat-first product, note that it's now on the legacy/v1 branch. The main branch is where the GenBI engine lives, and that's where you should focus your attention.

There's also an active community on Discord if you run into issues or want to see how others are using it.

Final Thoughts

WrenAI is best suited for teams that are building AI agents over business data and have hit the wall of "the model doesn't understand our business." If you're just prototyping a quick SQL generator, this might be more infrastructure than you need. But if you're building something that needs to be correct, auditable, and maintainable—especially in a team setting—the semantic layer approach is worth serious consideration.

The fact that context is stored as versionable, Git-friendly files is the quiet killer feature here. It means your AI's understanding of your business can be reviewed, tested, and improved like any other codebase. That's the kind of foundation that makes generative BI actually trustworthy, not just impressive in a demo.


Follow @githubprojects for more developer tools and open source projects.

Back to Projects
Project ID: d3f90daa-014d-45b9-8083-85ac3a6c5671Last updated: September 1, 2026 at 02:44 AM