Using DSPy to evaluate and improve Datasette Agent's SQL system prompts
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
Practitioners can now use DSPy as an automated harness to empirically find and fix flaws in production agent system prompts instead of hand-tuning them.
Simon Willison used DSPy, a framework for testing and refining how AI systems are instructed, to improve the prompts behind Datasette Agent, a tool that answers questions about data using read-only SQL. He asked Claude Code to run the experiment, which tested with GPT 4.1 mini and nano. The evaluation found the prompt's schema listing omitted column names, causing the AI to guess them and loop on errors. Fixing this makes the agent's answers more reliable.
This is a working demonstration that prompt quality for AI agents can be measured and improved systematically rather than by guesswork, using DSPy against real tool calls on a live in-process Datasette. Teams maintaining agent products gain a repeatable evaluation method; those relying on intuition-driven prompt editing fall behind on reliability. The approach used GPT 4.1 mini and nano as test models, keeping evaluation costs low.
The harness invokes DSPy agents against Datasette Agent's actual tool implementations and prompts running on a live in-process Datasette, evaluated against an auto-generated gold-standard dataset with custom metrics. Testing GPT 4.1 mini and nano surfaced a concrete prompt flaw: the schema listing exposed table names only, while '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. Recommended fix: include column names in the schema listing or soften that advice.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
Speculative Decoding Makes Tool Calls Faster. Agents Need a Cache.
Speed improvements in speculative decoding mean agents can execute tool calls faster, reducing latency for real-time applications.
OpenGame: turn your local coding agent into a full-stack game studio
Developers with a local coding agent can now scaffold full playable 3D games, art, music, testing, publishing, instead of only refactoring code, opening a path from hobby coding to shippable mini-games.
Let Claude Code or any agent tap, type, and read your real phone
Agents can now close the mobile testing gap by driving and reading a real phone themselves, with nothing installed on the device.