In Part 1, we organized files. Now, let's talk to data.
SQL is hard. Natural Language is easy. Today, we build a Local SQLite Analyst that lets you ask questions like "Who are my top users?" and gets answers from your private database.
The Goal
An agent that:
- Takes a question ("Show me errors from yesterday").
- Inspects your database schema.
- Writes the correct SQL query.
- Runs it locally and explains the result.
The Architecture
This agent needs to use Tools (specifically, the command line).
The Challenge: Model Smarts
In our tests, smaller models like llama3.2 struggled to plan these multi-step interactions. They often hallucinated or failed to check the schema first.
Solution: Use a smarter local model!
-
Download:
ollama pull gpt-oss:20b(orgemma3:12b) - These models have better "reasoning" capabilities.
The Recipe
title: SQLite Analyst
instructions: |
To answer user questions:
1. Run `sqlite3 .schema` to understand the DB.
2. Construct a valid SQL query.
3. Execute it using the shell tool.
4. Report the answer.
Run It
goose run --recipe sqlite_analyst.yaml --model gpt-oss:20b -s
Now you have a private Data Analyst on your laptop!
Next Up: In [Part 3], we'll fix "Spaghetti Code" automatically.


Top comments (0)