WrenAI is an open-source generative business intelligence (GenBI) engine designed to provide AI agents with a governed semantic layer and AI context layer, enabling them to turn business questions into correct SQL and generate shareable dashboards while respecting security boundaries.
Purpose: WrenAI primarily addresses the problem that AI agents lack business semantic understanding when generating SQL. The traditional model only tells agents where the data is (schema), whereas WrenAI tells agents what the data means—including approved metric definitions, enumerations, units, join relationships, examples, and tacit knowledge from documentation and chat logs. This content is stored as reviewable YAML and Markdown files in a Git repository owned by the user.
Key capabilities:
- Governed text-to-SQL: plans queries based on the semantic layer (MDL), performs dry-plan validation before execution, and includes safeguards such as row limits, value analysis, and structured error hints.
- Dashboard generation: agents can generate governed answers, deploy them as dashboards, and share URLs, forming an end-to-end GenBI loop.
- Semantic layer (MDL): defines models, columns, relationships, views, cubes, and metrics using a modeling definition language, keeping business definitions such as "revenue" consistent everywhere.
- Context layer: manages enumerations, units, approved joins, and definitions through instructions.md and queries.yml, and includes a local LanceDB memory index with hybrid retrieval.
- Multi-data-source support: built on the Apache DataFusion engine, supporting 22+ data sources including BigQuery, Snowflake, PostgreSQL, ClickHouse, Amazon Redshift, Databricks, and DuckDB.
- Agent SDK: provides wren-langchain (LangChain/LangGraph), wren-pydantic, and reference Python integrations.
- Git sync: deploys local projects via git push as team-level GenBI deployments (Wren Cloud or self-hosted), with metric changes managed through code review.
Usage:
- Install the CLI: pip install wrenai, and add connector extensions as needed, such as pip install "wrenai[postgres,memory]".
- Install the agent discovery stub: run the command to install the roughly 50-line discovery stub; the agent fetches the full workflow guide from the CLI on demand.
- Open the agent in the project folder and ask a question, for example "Use Wren to set up my Postgres database." The agent will check the environment, create the connection configuration, set up the project, and run the first query. If there is no database, the built-in jaffle_shop example can be used. If the HuggingFace model download times out, you can run export HF_ENDPOINT=https://hf-mirror.com。
Use cases: suitable for teams that want AI agents to produce trustworthy BI (answers and dashboards rather than merely plausible SQL); for situations where business logic (definitions, enums, units, approved joins) lives outside the database and agents frequently make mistakes; and for cases that need an open, reviewable, version-controlled context layer usable by all agents and people. Not suitable for cases that only need to generate one-off charts from a single CSV, or are willing to let agents guess SQL without governance.
Limitations: The core engine, SDK, and skills are open source under Apache-2.0 and can be self-hosted. Row-level and column-level security and access control, the GenBI UI, dashboards, embedding and APIs, scenario AI tools (GenBI Apps, Agentic Mode, AI-assisted context preparation), advanced security auditing, support and SLA, and cloud/VPC/air-gapped deployment are commercial features, available through Wren AI Cloud or self-hosted Enterprise Plus.