[Design] Deliver large AI tool results through previews and retrievable local artifacts #1941
openai0229
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 files can be read.
Design questions
Important implementation boundary
The current SQL tool executes with a bounded page size. Writing the current
ExecuteResponseto a file 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, local artifact lifecycle, and read-tool behavior before splitting the work into focused implementation issues.
All reactions