vanna-ai /vanna

๐Ÿค– Chat with your SQL database ๐Ÿ“Š. Accurate Text-to-SQL Generation via LLMs using Agentic Retrieval ๐Ÿ”„.

โ˜… 23,805โ‘‚ 2,550
PythonCreated 2023-05-13vanna.ai/docs/
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

Snapshot: 2026-11-10T09:35:25Z ยท Data license Apache-2.0 ยท JSON