跳到正文
Simon Willison 博客· Simon Willison·· 2026-06-11AI 评分66

datasette-agent 0.2a0 发布:新增 ask_user 和 save_query 工具

datasette-agent 0.2a0

AI 导读

datasette-agent 0.2a0 新增两个核心功能。工具可通过 `ToolContext` 对象的 `await context.ask_user(...)` 向用户提问,支持 yes/no、多选(`options=[...]`)或自由文本(`free_text=True`)。问题未回答时 agent 挂起,问题以表单形式渲染在聊天界面并持久化到内部数据库,服务器重启后对话可继续。工具应在执行副作用前调用 `ask_user()`,回答后从头重放。另一内置工具 `save_query` 允许 agent 将 SQL 保存为 Datasette 存储查询,但必须经人工批准——显示完整 SQL 及提议的名称、数据库和可见性,用户确认后才会存储。`ask_user` 功能基于作者昨日用 Claude Fable 5 构建的新 LLM alpha 实现。

正文 · 原文
  • Tools can now ask the user questions mid-execution. Tools that declare a context parameter receive a ToolContext object, and await context.ask_user(...) can ask a yes/no, multiple-choice (options=[...]) or free-text (free_text=True) question. While a question is unanswered the agent turn suspends: the question renders as a form in the chat UI and persists to the internal database, so suspended conversations survive a server restart. Once answered, the tool re-executes from the top with stored answers replayed, so call ask_user() before performing side effects. #20
  • New built-in save_query tool: the agent can save SQL it has written as a Datasette stored query. Saving always requires human approval - the agent shows the full SQL plus the proposed name, database and visibility, and nothing is stored until you click Yes. #20

The ask_user() feature was enabled by the new LLM alpha I built yesterday with the help of Claude Fable 5.

10th June 2026

来源:Simon Willison 博客 · simonwillison.net