Repository navigation
feat(tools): Defer rarely used tools - #2895
Conversation
Load only tools that many Conversations use, plus tools the system prompt names. Move 33 tools to the deferred catalog under sources that searchTools lists, and tell executeTool callers to use it for any tool a skill, tool result, or error names. Refs #2893 Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
One question we should answer: if some of these tools are never used, such as the bash tools, if we need them at all, or if we should just allow the agent to rely on bash Because part of the core is we want core tools loaded so that it knows to use them and doesn't have to look them up because if it has to look them up for common behavior, it's unlikely to use the tool |
|
16 screenshot changes — 16 changed · 0 added · 0 removed Review screenshots in Frameshift Show 10 more changed screenshots |
Sending a file and checking back later are common behaviors. The model is unlikely to search for them, so keep both direct. Co-Authored-By: David Cramer <[email protected]>
|
Agreed: a tool for common behavior stays loaded, because the model is unlikely to search for it. I applied that rule to this PR and to a stacked PR:
The rest of the deferred set has no |
Stacked on #2895. Answers the question in [this comment](#2895 (comment)): the sandbox search tools duplicate `bash`, so remove them instead of deferring them. `bash` is loaded on every Turn and already covers these with `rg`, `find`, and `ls`. ripgrep stays in the sandbox image. The separate tools only add tool-list cost and a second search path to maintain. **Removed** - `grep`, `findFiles`, `listDir`: tool files, sandbox dispatch, input normalization, and registration. - The search-only helpers in `file-utils.ts`, the `commandRunner` on the file-tool call context, and the `setToolCallSpanAttributes` hook that only search used. - `app.sandbox.search.*` span attributes and their `TELEMETRY.md` query. **Kept** - `readFile`, `editFile`, `writeFile`. They give bounded reads with continuation and exact edits with diffs, and `bash` does not do that well. - The `sandbox` catalog source now holds only `createPreview`, so its description covers only preview URLs. **Tests** - The sandbox recovery and stream-interruption tests now use `readFile` instead of `grep`/`findFiles`. They test the same behavior. - I deleted the ripgrep-specific cancellation test. It tested a path that no longer exists, and `bash` has its own cancellation coverage. Unit, component, and integration tests, typecheck, and lint all pass. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0B595QDZLL%3A1794073929.368779 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0B595QDZLL%3A1794073929.368779) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0B595QDZLL%3A1794073929.368779/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
Every direct tool puts its schema in every Turn, and most direct tools are rarely called. This change moves 31 rarely used tools to the deferred catalog.
searchToolsfinds them andexecuteToolruns them.How I picked them. I looked at recent tool-call telemetry. A tool stays direct when many Conversations call it, or when the system prompt or runtime context names it. Everything else is deferred.
Deferred now, grouped by catalog source:
sandbox:grep,findFiles,listDir,createPreview. ref(sandbox): Remove grep, findFiles, and listDir tools #2896, stacked on this PR, deletes the 3 search tools becausebashcovers them.slack: the 4 canvas tools, the 4slackList*tools,slackChannelJoin,addReactionimages:imageGenerate,publishImage,unpublishImageresource-watches:searchEventTypesautomations:createAutomation,searchAutomations,updateAutomation,deleteAutomation,runAutomationNowagents:searchAgents,stopAgentworkspaces:createWorkspace,updateWorkspace,deleteWorkspaceuser-customization:updateUserCustomizationgithub_commentOnPullRequest,github_submitPullRequestReviewStill direct:
bashand file tools,loadSkill,switchWorkspace,listWorkspaces, web search and fetch, Slack thread, channel, and public search reads,userLookup,updatePlan,reportProgress,viewImage,systemTime.github_createPullRequest,github_updatePullRequestFeedback,github_resolvePullRequestReviewThread. PR maintenance Turns call these often.addReviewItem,watchEvents,loadAttachment.sendFilesandwatchTimer.modelOnlyruntime tools do not change.Other changes:
source, so thesearchToolsdescription lists it. Without a source, the model can find a tool only by guessing a query.executeTooldescription now says to use it for a tool that is not in the tool list but that a skill, tool result, or error names. Examples are the GitHub egress denials and thegithub-codeskill text. A direct call to a deferred tool fails with "Tool X not found".policies/tool-design.mdgets a rule for when a tool is direct.Not in this PR: the ranking and result-format fixes for
searchTools(#2893). With more tools deferred, those fixes matter more, so they come next.Checks:
pnpm typecheck,pnpm lint, the tool checks,skills:check, and the junior and junior-github test suites pass. I did not run the LLM evals locally.Refs #2893
via @dcramer.
--
View Session [Sentry]