Repository navigation
feat(addons): let an add-on defer its tools behind the chat tool search - #13421
Merged
Merged
Conversation
An add-on with many tools sends every schema on every turn. A tool definition can now say "deferred": true. A chat then offers that tool through tool_search, tool_describe and tool_call instead of as a typed tool, under the same addon__<id>__<tool> name. The flag changes the prompt of a chat only. tool_call runs the function the chat would have offered, so the role of the kind, the approval and proposals, the chat's add-on switch, the agent ceiling and the acting user apply as for a typed call. A tool of an add-on that is off or not running for the chat is not listed and answers "no such tool". The setting chats_tool_search decides, with one answer for all deferrable sources of a chat: off never defers, on always does, auto defers when the schemas of the LocalAI groups and the deferred add-on tools together reach a tenth of the window. A tool that is not deferred is not counted. The answer depends only on its inputs, so the tool list is stable between turns. The manifest validator refuses the flag on a page-only tool, which no model is offered, and on a tool that shadows a built-in tool, which must keep its name. The page, MCP clients, agents and triggers list tools as before: the flag is not part of the adapter wire form. Assisted-by: Claude:claude-sonnet-5-5
…chat entries Fix round for the deferred add-on tools. Feature level: deferred is a new optional manifest field, so it is level 11. A manifest that sets it must declare featureLevel 11, and a host of level 10 refuses the add-on with "needs a newer LocalAI". HostFeatureLevel is now 11. Chat entries: a call made through tool_call on a deferred add-on tool is now stored and sent under the add-on tool name (session.SetToolAs), so the chat shows the same change note, Undo, proposal note and typed refusal as for the typed call. The UI pattern is unchanged and still strict. Decision: the LocalAI groups keep their own decision, and the deferred add-on tools are decided with the same modes on their own schema size, so installing or stopping an add-on never moves the groups. The bridge tools appear when either source is deferred. A tie in tool_search ranks LocalAI tools before add-on tools. The setting texts and docs name the add-on tools, and the docs say that a deferred tool still counts toward the add-on tool cap. Tests cover the unattended action policy, a saved agent that does not grant the add-on, per-agent resource lists, tool_describe of names outside the set, a viewer refused a write, the path without an owner, and sub-agents. Assisted-by: Claude:claude-sonnet-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
An add-on with many tools sends every tool schema to the model on every turn. A tool definition can now set
"deferred": true. A chat then offers that tool through the existing tool search (tool_search,tool_describe,tool_call) instead of as a typed tool. The tool keeps itsaddon__<id>__<tool>name.The flag changes the prompt of a chat only.
tool_callruns the same function the chat would have offered, so the role check of the tool kind, approvals and proposals, the chat's add-on switch, the agent ceiling, the action policy of an unattended run and the acting user apply as for a typed call. A tool of an add-on that is off or not running for the chat is not listed and answers "no such tool".chats_tool_searchdecides, per source.offnever defers,onalways does,autodefers when the schemas of the deferred add-on tools reach a tenth of the context window. The LocalAI tool groups keep their own decision, so installing an add-on never moves them. The decision depends only on its inputs, so the tool list stays the same between turns.deferredon the add-on tool definition. It needsfeatureLevel: 11(the host feature level is now 11), so an older host refuses the manifest with "needs a newer LocalAI". The validator refuses it on a page-only (uiOnly) tool and on a tool thatshadowsa built-in tool.tool_callis stored and reported under theaddon__<id>__<tool>name, so change notes, Undo and proposal notes appear as for a typed call.tool_searchranks LocalAI tools before add-on tools when scores tie.Notes for Reviewers
swagis not installed here.Signed commits
Assisted-by: Claude:claude-sonnet-5-5