Datasette Agent Turns SQLite Questions Into SQL and Charts. Here's How It Works

Datasette Agent Turns SQLite Questions Into SQL and Charts. Here's How It Works

●1 ●22 ●87
calendar_today ago • schedule6 min read

By Mahan Kenway

Cover illustration: original editorial artwork depicting a database, an assistant, and a chart.

A chart with a gap in it is an invitation to guess. In a new December 5 video, Datasette creator Simon Willison demonstrates a more useful workflow: ask an assistant to explore the underlying SQLite data, make a visualization, and add annotations that help explain what the chart shows.

The assistant is Datasette Agent, an open-source plugin for Datasette. It doesn't replace SQLite or magically turn a language model into a database engine. It gives a tool-calling model a way to inspect a database and run SQL, then present the results conversationally. The new video is a demonstration of that workflow, not the announcement of a brand-new product: the project's initial alpha was released in May 2026.

For developers sitting on a SQLite file, the interesting question isn't whether chatting with data is novel. It's whether this particular combination makes the path from an informal question to inspectable SQL and a useful chart shorter without hiding the decisions that matter.

What the assistant actually does

Datasette is a tool for exploring and publishing data, and Datasette Agent lives inside that environment. Its built-in tools can list databases and tables, describe table structure, and execute read-only SQL. The model chooses tools and interprets their results; SQLite still does the query execution. The project's README lists the available tools and their permissions.

That division is important. A question like “How did monthly orders change over the past year?” still needs concrete choices: which timestamp to use, whether cancelled orders count, and how to handle months with no rows. The model can propose SQL, but the answer is only as sound as those choices and the underlying data. A convincing paragraph doesn't prove the query used the correct definition of an order.

The good practice is to ask for the SQL alongside the answer and inspect it. Check joins for accidental duplicates, filters for excluded records, date boundaries and time zones, and whether a missing month means zero activity or missing data. For a consequential result, run an independently written query or compare against a known report.

From SQL to a chart, with context

The December demo combines the agent with Datasette Charts, a separate plugin that suggests and builds charts from tables, views, and SQL queries. Willison's walkthrough shows the assistant adding annotations to explain a gap in a chart. An annotation can make an important caveat visible where readers are likely to see it, instead of burying it in a chat transcript.

In the walkthrough, the example is a time series of project downloads. The assistant checks the date coverage after Willison spots a gap; Willison says his collection process had not been running. He then asks for the explanation to appear on the chart and changes it to a shaded region. That is a useful distinction: missing observations are not evidence that downloads fell to zero.

That isn't the same as establishing the cause of a gap. A chart can show that records are missing; determining why may require checking collection logs, release notes, or an independent source. Treat a model-generated explanation as a hypothesis until the evidence supports it.

One naming detail is easy to miss: datasette-agent-charts is a different plugin. Its documented render_chart tool builds Observable Plot charts from SQL results. The December video specifically points to the newer Datasette Charts integration; don't assume that installing one chart plugin automatically installs the other or provides an identical interface.

Try it with a sample database

The fastest way to get a feel for the interface is the public preview. It requires GitHub sign-in; Willison says the authentication is intended to discourage abuse. Explore public sample data first rather than assuming the preview is an appropriate place for confidential records.

For a local experiment, the original release instructions use uv and a sample database. With uv installed and an OpenAI API key available, the command looks like this:

wget https://datasette.io/legislators.db
export OPENAI_API_KEY="your-api-key"

uvx --prerelease=allow --with datasette-agent \
  datasette -s plugins.datasette-llm.default_model gpt-5.5 \
  --internal internal.db --root legislators.db

The command starts Datasette with the agent plugin and a local internal database, and provides a root sign-in link. Open the local instance and visit /-/agent. The example uses a hosted model, so the database being local does not make the whole workflow offline: prompts, relevant schema and tool results can be sent to the model provider. Provider charges and data-handling terms depend on the model and account. Keep API keys out of shared scripts and repositories.

The --root flag is convenient for a private demo, not a production access-control strategy. Keep the instance private, use test data, and configure appropriate authentication and permissions before exposing anything to other users. The model and package versions may change, so check the current documentation if an example no longer matches your environment.

Local models are an option, not a privacy switch

The model is pluggable. The release notes show an example using a Qwen model served through LM Studio, and the datasette-llm documentation also describes configuring OpenAI-compatible endpoints. The endpoint must support the protocol and tool calling required by the agent; merely pointing it at any local text generator isn't enough.

Running a compatible model locally can avoid sending model requests to a remote provider, but it doesn't automatically secure everything else. Check where Datasette is listening, who can access it, what plugins can do, and where conversation data and logs are stored. A third-party plugin or remote endpoint can change the data flow. Test the whole setup before using sensitive data.

The companion datasette-llm plugin also received a December 5 alpha update. It adds a datasette llm command, useful for managing model credentials when Datasette is installed in an isolated uv tool or pipx environment, plus OpenTelemetry spans and token-usage metrics. The release says those new spans do not record prompt text, response text or actor details; that is a statement about the instrumentation, not a blanket privacy guarantee for every provider or log.

The current agent README also describes a model picker: the selected model is pinned to a conversation, so switching models requires starting a new chat. That makes side-by-side testing possible, but don't assume two models will produce equivalent SQL or equally reliable explanations.

The guardrails worth understanding

The documented sql_query tool is read-only, but the agent also has a separate write tool. According to the README, write SQL is analyzed and shown for explicit approval before execution, and the requesting actor needs the relevant Datasette permissions. Importantly, if a sequence of write statements fails, earlier successful statements are not rolled back automatically. Back up data, review every statement and test changes on a disposable copy.

The same documentation says saving a proposed query requires human approval and that saved queries default to private. Those safeguards are useful, but they don't eliminate mistakes or prompt-injection risk from untrusted data. Use least-privilege accounts, review installed agent tools, and avoid automatically approving actions in environments where the consequences matter.

Why this is worth watching

The useful idea here is not a chatbot pasted onto a database. It's an inspectable loop: ask a question, let the assistant find relevant tables, examine the SQL, refine the result, and present it with a chart that carries its own context. That can make a small SQLite dataset more approachable for teammates who don't want to start with a blank SQL editor.

Datasette Agent is still an alpha project, and the December video is a demonstration rather than evidence of production reliability. For exploratory work, it looks like a practical way to get to a first answer quickly. For decisions that depend on the answer being right, the SQL, permissions, and provenance still need a human review.

Want more #ai & #opensource deep dives?

Join 6,181+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

Stop trusting verdicts your policy no longer supports

VEACESLAV - Dec 1

StarlingX 13.0 Turns Two Edge Upgrades Into One Reboot. Test the Targets Yourself.

Tom Smithverified - Nov 24

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19
chevron_left
2.6k Points • 110 Badges
77Posts
0Comments
4Connections
I'm a Developer and an avid Gamer. I love exploring the intersection of Artificial Intelligence, Cyb... Show more

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!