cd /news/ai-research/using-dspy-to-evaluate-and-improve-d… · home topics ai-research article
[ARTICLE · art-47352] src=simonwillison.net ↗ pub= topic=ai-research verified=true sentiment=↑ positive

Using DSPy to evaluate and improve Datasette Agent's SQL system prompts

Simon Willison used DSPy to evaluate and improve the system prompts for Datasette Agent, an AI tool that executes read-only SQL queries. The research identified that including column names in schema listings could reduce error-retry loops caused by column-name guessing. The work was conducted via Claude Code using Claude Fable 5 and tested with GPT 4.1 mini and nano.

read1 min views1 publishedJul 2, 2026

Research: Using DSPy to evaluate and improve Datasette Agent's SQL system prompts One of this morning's AIE keynotes covered dspy, which reminded me I've been meaning to see if it could help me improve the system prompt used by Datasette Agent - so I fired off an asynchronous research task in Claude Code for web using Claude Fable 5:

Pip install the latest Datasette alpha and datasette-agent and dspy - then figure out how to use dspy to evaluate and improve the main system prompts used by Datasette Agent for the feature where it can execute read only SQL queries to answer user questions about data.

Fable chose to test using GPT 4.1 mini and nano, and identified several promising looking directions for improvements. I particularly like this one:

The schema listing gives only table names; the "don't call describe_table if you already have the information" advice caused column-name guessing (page_count, o.order_id, first_name) and error-retry loops in baseline traces. Either include column names in the prompt's schema listing or soften that advice.

Tags: ai, datasette, generative-ai, llms, evals, dspy, datasette-agent, claude-mythos-fable

── more in #ai-research 4 stories · sorted by recency
── more on @dspy 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/using-dspy-to-evalua…] indexed:0 read:1min 2026-07-02 ·