Skip to content

add ToolSearchToolset and ToolProxyToolset for dynamic tool discovery#5140

Merged
longcw merged 13 commits intomainfrom
longc/tool-search-toolset
Apr 14, 2026
Merged

add ToolSearchToolset and ToolProxyToolset for dynamic tool discovery#5140
longcw merged 13 commits intomainfrom
longc/tool-search-toolset

Conversation

@longcw
Copy link
Copy Markdown
Contributor

@longcw longcw commented Mar 18, 2026

When agents have many tools (10+), loading all tool definitions into the LLM context upfront degrades accuracy and wastes tokens. This PR adds two toolsets that enable on-demand tool discovery and loading.

ToolSearchToolset — exposes a tool_search function. Matched tools are added directly to the LLM's tool list on the next turn, so the model uses native tool calls. Simpler for the model.

ToolProxyToolset — exposes exactly two fixed tools: tool_search (returns schemas) and call_tool (executes by name). The tool list remains unchanged, preserving prompt cache across turns for providers like OpenAI and Anthropic.

Both support:

  • Nested toolsets (MCPToolset), standalone tools, ProviderTool, and RawFunctionTool
  • Atomic toolset loading: if a tool picked belongs to a nested toolset, the whole toolset is loaded.
  • Pluggable search via SearchStrategy protocol
  • Built-in keywod and BM25 search strategy

need to merge #5138 first

References

@longcw longcw changed the title add ToolSearchToolset add ToolSearchToolset and ToolProxyToolset for dynamic tool discovery Mar 19, 2026
@longcw longcw marked this pull request as ready for review March 19, 2026 08:26
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@longcw longcw force-pushed the longc/tool-search-toolset branch from 2575393 to d6c9e1a Compare March 20, 2026 03:16
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Base automatically changed from longc/improve-toolsets to main March 23, 2026 14:46
@longcw longcw force-pushed the longc/tool-search-toolset branch from eb21a58 to 5086c77 Compare March 23, 2026 14:47
@longcw longcw merged commit f7b5dd4 into main Apr 14, 2026
21 of 23 checks passed
@longcw longcw deleted the longc/tool-search-toolset branch April 14, 2026 02:13
jayeshp19 pushed a commit to jayeshp19/agents that referenced this pull request Apr 14, 2026
* fix: allow multiple AsyncToolsets by deduplicating management tools (livekit#5369)

* feat(beta/workflows): add InstructionParts for modular instruction customization (livekit#5077)

* add ToolSearchToolset and ToolProxyToolset for dynamic tool discovery (livekit#5140)

* Feature - Configurable session close transcript timeout (livekit#5328)

* Fix FrameProcessor lifecycle for selector based noise cancellation (livekit#5433)

---------

Co-authored-by: Long Chen <longch1024@gmail.com>
Co-authored-by: Benjamin Lowe <ben.lowe.uk@googlemail.com>
Co-authored-by: Topherhindman <topher.hindman@livekit.io>
osimhi213 added a commit to de-id/livekit-agents that referenced this pull request Apr 15, 2026
* upstream/main: (31 commits)
  chore: reduce renovate noise (livekit#5421)
  Rename e2ee to encryption in JobContext.connect (livekit#5454)
  feat: add Runway Characters avatar plugin (livekit#5355)
  Fix FrameProcessor lifecycle for selector based noise cancellation (livekit#5433)
  Feature - Configurable session close transcript timeout (livekit#5328)
  add ToolSearchToolset and ToolProxyToolset for dynamic tool discovery (livekit#5140)
  feat(beta/workflows): add InstructionParts for modular instruction customization (livekit#5077)
  fix: allow multiple AsyncToolsets by deduplicating management tools (livekit#5369)
  fix: empty transcript blocks commit_user_turn until timeout (livekit#5429)
  Feature/krisp viva sdk support (livekit#4370)
  feat: add service_tier parameter to Responses API LLM (livekit#5346)
  fix(inworld): do not leak connections when when cancelled (livekit#5427)
  update: Sarvam STT - add verbose error loggin and remove retry connection (livekit#5373)
  chore(deps): update github workflows (major) (livekit#5424)
  (azure openai): ensure gpt-realtime-1.5 compatibility (livekit#5407)
  chore(deps): update dependency nltk to v3.9.4 [security] (livekit#5418)
  chore(deps): update dependency aiohttp to v3.13.4 [security] (livekit#5416)
  chore(deps): update dependency langchain-core to v1.2.28 [security] (livekit#5417)
  chore: pin GHA by commit (livekit#5415)
  fix(aws): unwrap doubly-encoded JSON tool arguments from Nova Sonic (livekit#5411)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants