Vanna 2.0 is a user-aware agent framework that connects LLMs to your database so people can ask questions in natural language and get back SQL results, charts, and summaries. An agent is given tools such as RunSqlTool, remembers how to use them through Tool Memory (successful interactions are saved and adapted when similar questions arrive), and enforces permissions so that every user's identity flows through system prompts, tool execution, and SQL filtering.
You define a UserResolver that extracts identity and group memberships from your existing auth (cookies, JWTs, OAuth tokens), register tools with access-group checks, and mount the chat routes on a FastAPI or Flask app. A prebuilt web component connects to the streaming endpoint and renders progress updates, a SQL block (shown to admin users by default), an interactive table, Plotly charts, and a natural-language summary as they arrive. Custom tools extend a Tool base class with a Pydantic args schema, and lifecycle hooks, LLM middlewares, context enrichers, and conversation storage cover quotas, logging, caching, RAG, and history. 2.0 is a rewrite of the 0.x VannaBase API; a LegacyVannaAdapter wraps an existing 0.x instance for the new UI.
Features
- User-aware execution: identity and group memberships apply to prompts, tools, and SQL
- Row-level security: queries are filtered per user permissions automatically
- Tool Memory: successful SQL queries and tool usage are stored and reused for similar questions
- Streaming UI components: tables, charts, SQL, and summaries stream to the web component in real time
- Web component: drops into React, Vue, or plain HTML pages and uses your existing cookies or JWTs
- LLM providers: OpenAI, Anthropic, Ollama, Azure, Google Gemini, AWS Bedrock, Mistral, and others
- Databases: PostgreSQL, MySQL, Snowflake, BigQuery, Redshift, SQLite, Oracle, SQL Server, DuckDB, ClickHouse, and others
- Custom tools: subclass Tool with a Pydantic schema and access groups
- Lifecycle hooks and middlewares: quota checks, audit logging, content filtering, caching, and cost tracking
- Observability: built-in tracing and metrics
- Migration path: LegacyVannaAdapter for 0.x instances and a step-by-step migration guide
