AI Builders: Building a text-to-SQL agent

Weights & Biases · Intermediate ·📊 Data Analytics & Business Intelligence ·1mo ago

Key Takeaways

Builds a text-to-SQL agent using LLM-powered SQL generation workflow and Marimo notebook

Original Description

Writing SQL has long been one of the biggest barriers standing between business users and the data they need. In this episode of AI Builders, we build a text-to-SQL analytics agent inside a Marimo notebook using DuckDB, Plotly, and an LLM-powered SQL generation workflow, then layer in observability and tracing and discuss what it takes to evolve the prototype into a production-ready reporting application. If you're a developer interested in building practical AI-powered analytics and reporting applications, this video is for you. Use the blog post and GitHub repo below to follow along and start experimenting. 💻 GitHub repo: https://github.com/rratshin-wandb/ai-builders 📘 Blog post: https://wandb.ai/wandb_fc/ai-builders/reports/Building-a-text-to-SQL-agent--VmlldzoxNzAyMDIwNQ NOTE from Russ: Second episode of the AI Builders series of YouTube videos "for developers who love to build and are having a great time bringing the wonders of AI into our applications." While this video does include mention of Weights & Biases products, the intro sequence should not be branded. Video will be linked to from a W&B blog post and GitHub repo. Thank you! ⏳Timestamps: 0:00 — Introduction and motivation for a text-to-SQL agent 1:39 — Diving into the agent notebook 2:08 — Overview of the project star schema and data model 2:23 — System prompt design and JSON output format 2:58 — Agent class design and function walkthrough 3:56 — Building Plotly charts from LLM-returned chart config 4:32 — Invoking the agent and inspecting results in Marimo 5:36 — Tracing and observability 6:28 — Monitoring and the path to production
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related Reads

📰
Por qué el "precio de lista" de una tienda no vale nada (y cómo construimos un tracker honesto)
Learn why list prices in stores are often misleading and how to build a tracker to monitor honest prices, applying data analysis and programming skills to make informed purchasing decisions.
Dev.to · Edu Tor
📰
FDA Recall API: A Working Guide to openFDA Enforcement
Learn to navigate the openFDA Enforcement API to retrieve drug, device, and food recall data, overcoming common issues like the 26,000-record skip wall and silent OR bug
Dev.to · Mayd-It
📰
Common Mistakes New Data Engineers Make (And How to Avoid Them)
Learn to avoid common mistakes new data engineers make to improve data pipeline efficiency and reliability
Dev.to · Abhishek Konagalla
📰
DuckDB vs PostgreSQL: I Ran the Same Query on Both. One Finished in 12ms. The Other Timed Out.
Compare DuckDB and PostgreSQL performance by running the same query on both to determine when to use each database system
Medium · Programming

Chapters (9)

Introduction and motivation for a text-to-SQL agent
1:39 Diving into the agent notebook
2:08 Overview of the project star schema and data model
2:23 System prompt design and JSON output format
2:58 Agent class design and function walkthrough
3:56 Building Plotly charts from LLM-returned chart config
4:32 Invoking the agent and inspecting results in Marimo
5:36 Tracing and observability
6:28 Monitoring and the path to production
Up next
How to Prompt Your LLM Directly from SQL
Ian Wootten
Watch →