Datasette Agent: The AI Assistant That Lives Inside the Permission Layer

· AI & Models · Datasette · SQLite · AI Agents · Text-to-SQL · Developer Tools

Simon Willison's Datasette Agent adds a chat assistant to any Datasette instance, but the design point is placement: tools execute as the logged-in actor and per-tool permissions are filtered before the model ever sees them.

Datasette Agent: The AI Assistant That Lives Inside the Permission Layer

A SQLite assistant that inherits the server's permission model instead of bypassing it

Executive Takeaway: One datasette install datasette-agent adds a chat assistant that writes and runs SQL against your data. The design decision worth studying is placement: the tool loop runs inside the Datasette process, so each query executes as the requesting actor and each write pauses for an explicit, in-chat approval.

It is not a new database, a hosted notebook, or a separate analytics SaaS. It is a plugin with a tool-registration API, which turns existing Datasette plugins - charts, image generation, sandboxes - into agent capabilities rather than one-off integrations.

Agent chat rendering a SQL result as a bar chart, with a collapsible View SQL query link beneath it
Agent chat rendering a SQL result as a bar chart, with a collapsible View SQL query link beneath it

Datasette Agent preview instance

1 · What Actually Changed

Text-to-SQL left the demo notebook and moved onto your server

The old bottleneck was never SQL generation quality. It was custody: giving a model a database connection meant giving it your identity, your permissions and your write path. Datasette Agent attacks that by refusing to hold credentials of its own.

Server-Side Loop, Actor-Scoped

Every tool call executes as the logged-in user

The agent is a Datasette plugin, so sql_query runs through Datasette's own query path as the current actor. Permissions, row restrictions and database visibility come from the host app, not from a second ACL the model might drift out of sync with.

Long-running work suspends rather than blocks: an approval form is persisted to the internal database and survives a server restart, and the tool re-executes from the top when the answer arrives.

Tools Vanish Before the Model Sees Them

Capability filtering happens at prompt assembly, not at call time

Each AgentTool can declare required_permission. Before the tool list is sent to the model, the harness checks it against the actor and drops anything they cannot use. The model never learns the tool exists, so there is no runtime denial branch for plugin authors to handle.

That is the cleanest part of the design - and the most surprising failure mode, covered later.

Schema On Demand, Not In the Prompt

Typing # attaches one table's DDL instead of the whole database

Typing # in the composer opens an autocomplete over tables, views, stored queries and databases. The tagged item is attached to the message as a note containing its CREATE TABLE statement, or a query's title, parameters and SQL.

Permissions are re-checked server-side when the message is sent, so a guessed id yields a name without details. Context is capped at 20,000 characters per reference, and describe_table / describe_query stay available for deeper lookups.

Charts Arrive as a Tool, Not a Feature

datasette-agent-charts renders Observable Plot HTML inline

The chart plugin returns _html alongside its tool result. Keys beginning with _ are stripped before the result goes back to the model, so the user sees a rendered chart while the model only sees a short summary - a useful pattern for any expensive visual output.

The Advent demo shows the payoff: asking the agent to annotate a chart to explain a gap in the data, with a View SQL query link that reopens the generated query in Datasette's editable SQL page.

2 · Benchmarks & Landscape

No vendor benchmark here - the honest numbers are scope, cadence and surface area

Datasette Agent publishes no accuracy or latency benchmark, so treat vendor silence as silence. What is measurable is how fast the package is growing and how it differs structurally from the alternatives.

Twelve Alphas, 2.6x the Wheel

122 KB at 0.1a0 in May, 323 KB at 0.7a1 in November

Wheel size is a crude proxy, but it tracks the README: background agents, browser tasks, reference types and tagging all landed inside seven months. The surface is expanding faster than the version number suggests.

Agent vs. the Alternatives

Where the query actually executes is the dividing line

DimensionDatasette AgentMCP SQLite serverHosted chat-with-data
Runs whereYour Datasette processYour MCP clientVendor cloud
Query identityDatasette actorClient's DB userVendor service account
SQL visible to userYes, inline linkTool output onlyUsually hidden
Write approvalPer statement, in chatClient-dependentRare
New capabilityPlugin hookNew MCP serverNot possible

Repository Reality Check

Read the maturity signals, not the demo

SignalValue
Latest version0.7a1, prerelease
Releases since May12
Commits194
Stars / forks128 / 8
Contributors4, including @claude
License / runtimeApache-2.0, Python 3.11+
Language mix70.9% Python

3 · Limits, Costs & Counterarguments

The plugin architecture is sound; the release is not finished

None of the following is a reason to skip the evaluation. All of it is a reason not to put it in front of untrusted users without a copy of the database.

Still a Prerelease at 0.7a1

Twelve alphas, zero stable versions

Every release so far is an alpha, and the README documents behaviour that is still moving - the model picker, panel navigation and tagging API all changed in November alone. Pin the exact version in any deployment and read the changelog before upgrading.

Writes Are Ordered, Not Transactional

Earlier statements stay committed when a later one fails

execute_write_sql runs statements in order and skips the rest after a failure, but it does not roll back what already succeeded. Idempotency and backups are your responsibility, and the approval prompt shows SQL plus destructive-operation warnings precisely because the database will not save you.

A Model Is Pinned Per Conversation

The model cannot be switched mid-thread

The choice is fixed when a conversation starts; later messages keep the same model even if the configured default changes. If that model is blocked, delisted, or loses its API key, the conversation stops with an error and you start over - which leaks context and tokens on long explorations.

Missing Tools Fail Silently

The model cannot ask for a capability it was never shown

Because tools are filtered before prompt assembly, an actor without datasette-agent-background sees an agent that simply cannot spawn background work. Panels, ask_user and browser tasks are likewise absent in CLI and background runs, surfacing only as tool errors when a plugin assumes them.

No Documented Token Budget

Cost per question is unbounded by design

"Explore a whole database" is a loop of sql_query calls with no per-conversation ceiling documented in the README. The public demo deliberately uses a cheap, fast model (Gemini 3.1 Flash-Lite) because it is proficient at the SQLite queries involved - not because it is the strongest reasoner available.

4 · Practical Decision Playbook

Treat it as a read-only analyst first, an operator second

Adopt, Pilot, or Wait

The split is about write access, not model quality

  • Adopt now: you already run Datasette internally and want read-only exploration over trusted analysts' own data, with SQL visible for review.
  • Pilot: writes matter, but you can point it at a copy, require approval, and accept alpha churn.
  • Wait: you need 1.0 stability, multi-tenant isolation guarantees, or published cost-per-question numbers for procurement.

Config That Survives the Alpha

Pin the model list and constrain the persona

Two settings do most of the safety work: an explicit allowlist for the agent purpose, and a system prompt appended to the built-in one so your reporting rules survive upgrades.

plugins:
  datasette-llm:
    purposes:
      agent:
        model: gpt-5.5
        models:
        - gpt-5.5
        - gpt-5.4-mini
  datasette-agent:
    system_prompt: |
      Always show the row count behind any aggregate.
      Never run write SQL without naming the table first.

One-Hour Read-Only Evaluation

Point it at a copy and inspect the tool surface before chatting

Run against a snapshot of production, as root only on localhost, and dump the registered tools first. If execute_write_sql appears where you do not want it, the permission layer is how you remove it - not a prompt.

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

datasette agent tools --json

5 · Verified Sources

Primary announcement, code, and the Advent video entry

Primary Announcements

Simon Willison on X: Advent Day 4 covers Datasette Agent

Advent video: Datasette Agent with charts

Simon Willison's Weblog, 5 December 2026

datasette.io homepage: the advent calendar grid with the Datasette Agent video as the newest entry
datasette.io homepage: the advent calendar grid with the Datasette Agent video as the newest entry

Docs, Code and Releases

agent.datasette.io preview

Launch post, 21 May 2026

datasette/datasette-agent on GitHub

PyPI release history

Plugin Ecosystem

datasette-agent-charts (Observable Plot)

datasette-agent-openai-imagegen

datasette-agent-sprites (Fly sandbox)

GitHub social card for the datasette-agent repository
GitHub social card for the datasette-agent repository

中文导读:Datasette Agent:把 AI 助手装进数据库的权限层

Datasette Agent 用一条安装命令给 Datasette 接上对话助手。关键在位置而非模型:工具以登录者身份执行,权限在进入提示词之前就完成裁剪。

Primary Sources & References

  1. Simon Willison on X
  2. Datasette Agent Advent video
  3. Datasette Agent launch post
  4. datasette/datasette-agent on GitHub
  5. PyPI release history