MotherDuck

YouTube

Virtual Workshop: Build a Data Agent in 60 Minutes

2026-10-01 15:41 UTC
Length: 51:58

This talk explains how to build a conversational data agent from scratch, focusing on the Model Context Provider (MCP), guardrails, and telemetry. The core problem is enabling a language model to safely and repeatably generate SQL queries against a database while providing a transparent user interface. It is useful for data engineers and analysts who want to create chat‑based data exploration tools. The speaker highlights tools such as Gemini 3 Flash via OpenRouter, Vercel, a lightweight charting library called Invis, and read‑only database tokens.

Insights

1. Agentic Loop Architecture
1.1 Uses a while loop that repeatedly calls the LLM until a satisfactory answer is produced or a max iteration limit is reached.

2. Model Context Provider (MCP)
2.1 Injects database schema and sample data into the LLM’s context so it can generate accurate SQL.

3. Guardrails with Read‑Only Tokens
3.1 Ensures the agent can only execute SELECT statements, preventing destructive queries and protecting data integrity.

4. Transparent UI and Telemetry
4.1 Displays each tool call and result, renders charts via Invis, and stores conversation history locally for auditability.

5. Skill vs System Prompt Design
5.1 For narrow tasks, embed all instructions in the system prompt; for broader applications, expose skills as separate tools that the MCP can invoke.

6. Per‑User Access via OAuth
6.1 Issues individual read‑only tokens so each user can query only their authorized data, while shared context can be stored locally in the browser.

Watch on YouTube