Skip to content

feat(addons): let an add-on defer its tools behind the chat tool search - #13421

Merged
mudler merged 2 commits into
mudler:masterfrom
mudler-agent:feat/addon-deferred-tools
Nov 23, 2026
Merged

mudler merged 2 commits into
mudler:masterfrom
mudler-agent:feat/addon-deferred-tools

Conversation

@mudler-agent

Copy link
Copy Markdown
Collaborator

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 its addon__<id>__<tool> name.

The flag changes the prompt of a chat only. tool_call runs 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".

  • Setting: chats_tool_search decides, per source. off never defers, on always does, auto defers 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.
  • Contract: new optional field deferred on the add-on tool definition. It needs featureLevel: 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 that shadows a built-in tool.
  • Chat: a call made through tool_call is stored and reported under the addon__<id>__<tool> name, so change notes, Undo and proposal notes appear as for a typed call.
  • Other callers: pages, MCP clients and the grant lists ignore the flag. Saved-agent chats and trigger-started runs are chats, so they get deferred tools through the bridge, gated at each call.
  • tool_search ranks LocalAI tools before add-on tools when scores tie.

Notes for Reviewers

  • Deferred add-on tools still count toward the add-on tool cap.
  • The tools panel does not show add-on deferral yet; that needs a new field in the panel data and the React menu.
  • The studio tests use a fake broker that enforces the role by kind; the real broker is not reachable from the test helpers.
  • The swagger files are edited by hand, because swag is not installed here.

Signed commits

  • Yes, I signed my commits.
  • Documentation updated (docs/content/) for user-facing changes, or not applicable

Assisted-by: Claude:claude-sonnet-5-5

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
@mudler
mudler merged commit 013d871 into mudler:master Nov 23, 2026
73 of 108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants