I Built My First AI Agent Loop on DuckDB (Python + Haiku)

Hoyt Emerson | The Full Data Stack
10,532 views •

I built an agent loop. Not a giant autonomous coding agent: a tiny, locked-down Python agent that can only query DuckDB. This video is sponsored by MotherDuck: https://motherduck.com/ In this video I walk through the whole proof of concept: how the loop works, the single query_database tool, the read-only SQL guardrails, and the agent traces database that logs everything the agent does. Then I run it against my production DuckLake gold layer with Claude Haiku, watch it fail at 5 iterations, bump it to 25, and dig into the traces to see exactly how it got its answer. Video Links: Agent PoC Github: https://github.com/early-signal-tech/duckdb-agent-loop-poc Previous DuckDB + AI Video: https://www.youtube.com/watch?v=j0SstAVc0LY My Links: Substack: https://thefulldatastack.substack.com/ LinkedIn: https://www.linkedin.com/in/hoytemerson/ X: https://x.com/HoytEmerson My content company: https://www.earlysignal.tech/ Timestamps: 0:00 Why I built an agent loop 1:16 Sponsor: MotherDuck 2:06 What the agent does and why 4:16 The harness file 8:47 The agent file 14:16 Design notes markdowns 14:40 Terminal setup (Ghostty, DuckDB) 15:54 Run 1: hitting the 5-iteration limit. 17:23 Run 2: 25 iterations with Haiku 18:55 The final analysis 19:57 Auditing the agent in the traces d 23:03 A guardrail rejection in the traces 24:49 What's next

Keyboard shortcuts

On. Switch them off if they collide with your assistive tools; ? still opens this sheet.

Go to

Press g then the letter.

  • gh Latest
  • gs Sources
  • gm Media
  • gv Videos
  • gp Podcasts
  • gc Calendar
  • gd Decoder
  • gz Dataviz
  • ga Datasets
  • gb Blog
  • gk Markets
  • gj Careers
  • gn Prompt Notebook

On this page

  • / Focus search, where there is one
  • t Back to top
  • ? This list
  • Esc Close