[Design] Deliver large AI tool results through previews and retrievable local artifacts #1941
Replies: 1 comment
Proposal: lock a minimal v1 decision set for #1941 / #1942Thanks for framing this clearly. I reviewed the current AI tool paths and a local design draft aligned with this Discussion / #1942. Current behavior (today)
So the user-visible gap in #1942 is real even before storage work starts. Proposed v1 decisions (please accept / reject each)I propose we treat the following as the first implementation boundary:
Suggested split after acceptance
Maintainer questions (blocking)Please confirm:
Non-goals for this commentI’m not asking to implement the full artifact system in one PR. Happy to adjust any of these decisions based on maintainer preference. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Context
Chat2DB Community AI tools must keep tool responses small enough for the model context while still making complete execution results available when the model needs more detail.
The current tool paths use fixed bounds in several places, including datasource lists, table lists, table-schema lookup, and SQL row previews. Returning every row inline is not practical, but returning only a preview can hide whether the result is complete.
This design question surfaced while reviewing #1876.
Proposed direction
Use a two-level result model for large AI tool outputs:
For example:
{ "success": true, "summary": "Returned 50 of 12438 rows. The complete result is available as an artifact.", "data": { "preview": { "columns": ["id", "name"], "rows": [] }, "completeness": { "complete": false, "returnedRows": 50, "totalRows": 12438 }, "artifact": { "id": "art_01K...", "format": "jsonl", "sizeBytes": 4821932, "expiresAt": "2026-07-24T10:00:00Z" } }, "errorCode": null }The model would retrieve more data through a controlled tool such as:
The artifact identifier should be opaque. The tool response should not expose an arbitrary local filesystem path because the model cannot access the host filesystem directly and Chat2DB must control which artifacts can be read.
Storage and retrieval boundary
Design questions
Important implementation boundary
The current SQL tool executes with a bounded page size. Writing the current
ExecuteResponseto any storage implementation would preserve only the fetched page, not necessarily the complete query result. Producing a genuinely complete artifact may require a separate streaming execution or export path with cancellation, resource limits, and cleanup.Scope
This discussion covers Chat2DB Community and its local runtime only.
Desired outcome
Agree on the Community result contract, the storage-neutral artifact lifecycle, the default local implementation, and bounded retrieval and filtering behavior before splitting the work into focused implementation issues.
Tracking
The Issue owns the user problem, scope, priority, acceptance criteria, and implementation tracking. This Discussion owns unresolved design questions, alternatives, and decision records.
All reactions