Repository navigation
Studio: enable local tool calling for self-hosted OAI-compat connections - #8626
Closed
khalidejaz wants to merge 2 commits into
Closed
khalidejaz wants to merge 2 commits into
khalidejaz wants to merge 2 commits into
Conversation
…ons (unslothai#7282) Self-hosted connections (llama.cpp / vLLM / Ollama / custom) advertise the registry's provider-level studio_tools capability, so their Search / Code / MCP toggles light up and tool requests enter Unsloth's local tool loop against the remote endpoint instead of being proxied tool-less. Two halves: - Backend: provider_runs_local_tools() reads PROVIDER_REGISTRY's model_capabilities "*" wildcard; the loop gate follows the explicit enable_tools / enabled_tools / mcp_enabled signal (never a CLI policy alone), keeps client-supplied tools on the pure passthrough, honors a zero tool-call budget, caps per-turn fan-out, and supports interactive confirm through the shared approval gate like the local GGUF / safetensors loops. - Frontend: providerModelSupportsStudioTools() falls back to the provider-level capability and the Search/Code pills consult it, so the same registry-driven mechanism the Codex loop uses decides self-hosted tool support. No hardcoded provider-type list. Hidden registry entries are now served (with a hidden flag) so the capability reaches the frontend through the existing /registry pipeline. Fixes unslothai#7282. Supersedes the independently-written unslothai#7330.
Contributor
|
Thanks @khalidejaz. We incorporated the provider-level #8630 now supersedes this implementation with the same registry-driven Search, Code, MCP, and RAG coverage plus an explicit per-connection trust opt-in, correct automatic high-risk approvals, separately flushed Tauri approval cards, usage and finish-reason preservation, reasoning support, forced-choice and budget correctness, partial-markup suppression, provisional cards, and stalled-model recovery. Manually verified both external-provider and native approval flows in the Tauri desktop app. |
Contributor
Author
This was referenced Aug 13, 2026
danielhanchen
added a commit
that referenced
this pull request
Aug 14, 2026
The squash merge of #8665 kept only two trailers, so the four PRs that work was built out of are not attributed anywhere in main's history. Recording them here. #8626 (@khalidejaz) contributed the registry capability and the hidden-entry exposure, down to the provider_runs_local_tools() name. #8630 (@mahiatlinux) contributed the loop internals: the user-turn append, the tool-stream advance and drain, usage merging, the approval flush delay, the budget-exhausted nudge and the streamed tool-name fix, plus a number of its test cases. They also built the merged branch and drove it in a browser against a control worktree, which found several real defects before release, including a truncated turn discarding a healed call together with the text describing it. #7805 (@Etherll) contributed the hosted-provider reach. #7330 (@Souravrajvi0) is the original OpenAI-compatible framing the work started from. Two things were deliberately not taken, and the difference is worth recording: the per-connection framing from #8630 and the studio_tool_execution column from #7805. #8665 shipped a static disclosure instead while widening the capability from four self-hosted types to thirteen. Co-authored-by: Malik Khalid Ejaz <[email protected]> Co-authored-by: Maheswar Kumar <[email protected]> Co-authored-by: Etherl <[email protected]> Co-authored-by: Souravrajvi0 <[email protected]>
danielhanchen
added a commit
that referenced
this pull request
Aug 14, 2026
) The squash merge of #8665 kept only two trailers, so the four PRs that work was built out of are not attributed anywhere in main's history. Recording them here. #8626 (@khalidejaz) contributed the registry capability and the hidden-entry exposure, down to the provider_runs_local_tools() name. #8630 (@mahiatlinux) contributed the loop internals: the user-turn append, the tool-stream advance and drain, usage merging, the approval flush delay, the budget-exhausted nudge and the streamed tool-name fix, plus a number of its test cases. They also built the merged branch and drove it in a browser against a control worktree, which found several real defects before release, including a truncated turn discarding a healed call together with the text describing it. #7805 (@Etherll) contributed the hosted-provider reach. #7330 (@Souravrajvi0) is the original OpenAI-compatible framing the work started from. Two things were deliberately not taken, and the difference is worth recording: the per-connection framing from #8630 and the studio_tool_execution column from #7805. #8665 shipped a static disclosure instead while widening the capability from four self-hosted types to thirteen. Co-authored-by: Malik Khalid Ejaz <[email protected]> Co-authored-by: Maheswar Kumar <[email protected]> Co-authored-by: Etherl <[email protected]> Co-authored-by: Souravrajvi0 <[email protected]>
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.
Summary
Self-hosted connections (llama.cpp / vLLM / Ollama / Custom) had Search / Code / MCP greyed out, so tool requests were proxied without any tool schemas and the models answered "I can't browse/search." This declares a provider-level
studio_toolscapability inPROVIDER_REGISTRY(the"*"wildcard inmodel_capabilities), which flows through the same registry-driven pipeline the Codex loop uses (providerModelSupportsStudioTools/supportsStudioToolsForThisTurn), so the pills light up and requests enter Unsloth's local tool loop against the remote endpoint.What's included
provider_runs_local_tools()reads the registry; the gate follows the explicitenable_tools/enabled_tools/mcp_enabledsignal, keeps client-supplied tools on passthrough, honors a zero tool-call budget, caps per-turn fan-out, and supports interactive confirm via the shared approval gate (same as the GGUF/safetensors loops). Hidden registry entries are now served with ahiddenflag so the capability reaches the frontend.providerModelSupportsStudioTools()falls back to the provider-level capability; Search/Code pills consult it. No hardcoded provider-type list.Motivation
Fixes #7282. Supersedes the independently-written #7330 — this implementation expresses the self-hosted capability through the registry rather than a hardcoded provider list, so it rides the exact mechanism upstream uses for Codex.
Test plan
pytestontest_external_agentic.py,test_external_local_tool_gate.py,test_permission_mode.py,test_tool_confirm_loop.py(+ full external/codex suites) — all pass.ruff check+ repo format hook clean;tsc -band frontend unit tests pass.confirm_tool_callsshows the approval dialog.