What is Vanna?
Vanna is an open-source Python framework for building natural-language-to-SQL applications. A user asks a question in plain English, and Vanna's agent generates SQL, runs it against your database, and streams back an interactive table, Plotly charts, and a written summary. It sits in the RAG Frameworks & Platforms category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed MIT.
Overview
Vanna is an open-source Python framework for building natural-language-to-SQL applications. A user asks a question in plain English, and Vanna's agent generates SQL, runs it against your database, and streams back an interactive table, Plotly charts, and a written summary.
Vanna 2.0 is built around user-aware agents for production use. Identity from your own auth system (cookies, JWTs, or OAuth) flows through the system prompt, tool execution, and SQL filtering, so each user only sees the rows their permissions allow. It ships with a pre-built `<vanna-chat>` web component and integrates with FastAPI or Flask.
What it does
- Generates SQL from plain-English questions and returns tables, charts, and natural-language summaries
- User-aware at every layer: identity flows through prompts, tools, and row-level SQL filtering
- Pre-built `<vanna-chat>` web component that drops into React, Vue, or plain HTML and uses your existing cookies or JWTs
- Streaming responses deliver real-time progress, tables, and Plotly charts to the frontend
- Works with many LLMs (OpenAI, Anthropic, Ollama, Azure, Gemini, Bedrock, Mistral) and databases (PostgreSQL, MySQL, Snowflake, BigQuery, SQLite, and more)
- Extensible with custom tools, lifecycle hooks for quotas and logging, LLM middlewares, and built-in observability
Getting started
Vanna integrates into an existing FastAPI app. You define how to resolve a user from a request, register the agent and its tools, then add the chat routes. The pre-built web component connects to the streaming endpoint.
Set up an agent and register routes
In your FastAPI app, define a user resolver that extracts identity from your auth system, build an agent with an LLM service and a SQL tool, then register the chat routes.
from fastapi import FastAPI
from vanna import Agent
from vanna.servers.fastapi.routes import register_chat_routes
from vanna.servers.base import ChatHandler
from vanna.integrations.anthropic import AnthropicLlmService
from vanna.tools import RunSqlTool
from vanna.integrations.sqlite import SqliteRunner
from vanna.core.registry import ToolRegistry
app = FastAPI()
llm = AnthropicLlmService(model="claude-sonnet-4-5")
tools = ToolRegistry()
tools.register(RunSqlTool(sql_runner=SqliteRunner("./data.db")))
agent = Agent(llm_service=llm, tool_registry=tools, user_resolver=MyUserResolver())
chat_handler = ChatHandler(agent)
register_chat_routes(app, chat_handler)Drop the chat component into your page
Add the Vanna component script and the `<vanna-chat>` element, pointing it at your streaming endpoint. It uses your existing cookies or JWTs.
<script src="https://img.vanna.ai/vanna-components.js"></script>
<vanna-chat sse-endpoint="/api/vanna/v2/chat_sse"></vanna-chat>Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Adding a natural-language data-analytics interface to an application so non-technical users can query a database without writing SQL
- Building multi-tenant SaaS dashboards where queries must be automatically filtered per user permissions with row-level security
- Giving teams a pre-built chat UI plus backend that streams tables and charts, integrated with their existing authentication system
- Enterprise reporting that needs audit logs, per-user rate limits, and compliance tracking on every query
How Vanna compares
Vanna alongside other open-source rag frameworks & platforms tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Dify | ★ 162k | An open-source platform with a visual workflow builder for creating LLM and RAG applications without writing much code. |
| graphify | ★ 155k | Turns a folder of code, docs, PDFs and images into a local knowledge graph with tree-sitter AST parsing and Leiden communities — queryable by agents over MCP, no vector store. |
| RAGFlow | ★ 95k | A RAG engine built around deep document understanding that turns complex files into a grounded, citation-backed question-answering layer. |
| Context7 | ★ 65.7k | Context7 pulls current, version-specific documentation and code examples for any library and feeds them into your LLM, available as a CLI skill or an MCP server. |
| Pathway | ★ 61.9k | A Python framework with a Rust streaming engine that keeps ETL, real-time analytics and RAG pipelines continuously up to date as source data changes. |
| LightRAG | ★ 41k | A graph-based RAG system that builds an entity-and-relationship knowledge graph for fast retrieval and easy incremental updates. |
| PageIndex | ★ 40.8k | PageIndex turns long PDFs into a table-of-contents tree and uses LLM reasoning to retrieve relevant sections, with no vector database and no chunking. |
| Vanna | ★ 23.8k | Turn plain-English questions into SQL and live data insights |

