vanna-ai /vanna
๐ค Chat with your SQL database ๐. Accurate Text-to-SQL Generation via LLMs using Agentic Retrieval ๐.
โ
23,805โ 2,550
23,805
stars
+0+1+-9
2,550
forks
โ
watchers
โ
prs
โ
issues
โ
releases
โ
discussions
README
Vanna 2.0: Turn Questions into Data Insights
Natural language โ SQL โ Answers. Now with enterprise security and user-aware permissions.
https://github.com/user-attachments/assets/476cd421-d0b0-46af-8b29-0f40c73d6d83
!Vanna2 Demo
---
What's New in 2.0
๐ User-Aware at Every Layer โ Queries automatically filtered per user permissions
๐จ Modern Web Interface โ Beautiful pre-built component
โก Streaming Responses โ Real-time tables, charts, and progress updates
๐ Enterprise Security โ Row-level security, audit logs, rate limiting
๐ Production-Ready โ FastAPI integration, observability, lifecycle hooks
Upgrading from 0.x? See the Migration Guide | What changed?
---
Get Started
Try it with Sample Data
Quickstart
Configure
Configure
Web Component
html
Uses your existing cookies/JWTs. Works with React, Vue, or plain HTML.
---
What You Get
Ask a question in natural language and get back:
1. Streaming Progress Updates
2. SQL Code Block (By default only shown to "admin" users)
3. Interactive Data Table
4. Charts (Plotly visualizations)
5. Natural Language Summary
All streamed in real-time to your web component.
---
Why Vanna 2.0?
โ
Get Started Instantly
Production chat interface
Custom agent with your database
Embed in any webpage
โ
Enterprise-Ready Security
User-aware at every layer โ Identity flows through system prompts, tool execution, and SQL filtering
Row-level security โ Queries automatically filtered per user permissions
Audit logs โ Every query tracked per user for compliance
Rate limiting โ Per-user quotas via lifecycle hooks
โ
Beautiful Web UI Included
Pre-built component โ No need to build your own chat interface
Streaming tables & charts โ Rich components, not just text
Responsive & customizable โ Works on mobile, desktop, light/dark themes
Framework-agnostic โ React, Vue, plain HTML
โ
Works With Your Stack
Any LLM: OpenAI, Anthropic, Ollama, Azure, Google Gemini, AWS Bedrock, Mistral, Others
Any Database: PostgreSQL, MySQL, Snowflake, BigQuery, Redshift, SQLite, Oracle, SQL Server, DuckDB, ClickHouse, Others
Your Auth System: Bring your own โ cookies, JWTs, OAuth tokens
Your Framework: FastAPI, Flask
โ
Extensible But Opinionated
Custom tools โ Extend the Tool base class
Lifecycle hooks โ Quota checking, logging, content filtering
LLM middlewares โ Caching, prompt engineering
Observability โ Built-in tracing and metrics
---
Architecture
!Vanna2 Diagram
---
How It Works
mermaid
sequenceDiagram
participant U as ๐ค User
participant W as ๐
participant S as ๐ Your Server
participant A as ๐ค Agent
participant T as ๐งฐ Tools
U-W: "Show Q4 sales"
W-S: POST /api/vanna/v2/chat_sse (with auth)
S-A: User(id=alice, groups=[read_sales])
A-T: Execute SQL tool (user-aware)
T-T: Apply row-level security
T-A: Filtered results
A-W: Stream: Table โ Chart โ Summary
W-U: Display beautiful UI
Key Concepts:
1. User Resolver โ You define how to extr