fix: add include_default_tools parameter to LLMAgent to prevent unwanted inbuilt tool calls#289
Conversation
…t of inbuilt tools
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
for more information, see https://pre-commit.ci
|
Hey @saakshisinghal14, PR #167 by @yashhzd addresses the same issue in the same way. It also adds an opt-out flag to LLMAgent.init and passes it through to ToolManager. I would suggest since PR #167 was first and has similar intent, it might be worth either closing this one in its favor, or leaving a comment on #167 discussing the differences so the maintainers can make an informed call. Thanks for putting in the work on this! |
|
Thanks for pointing this out @BhoomiAgrawal12 . I wasn't aware of PR #167 when I opened this — it predates my involvement with the repo. Looking at it, #167 takes a more thorough approach by adding the flag to ToolManager itself and including a remove_tool() method, which is cleaner than my post-creation filtering. I'm happy to defer to #167 if the maintainers prefer that approach. |
Fixes #254
Summary
When an agent registers only domain-specific tools (e.g.
adopt_opinion), the LLM executor can still call inbuilt tools likemove_one_step— even when the simulation has nothing to do with movement.This happens because
ToolManagerauto-registers inbuilt tools globally, with no way to opt out. When the executor must choose a tool, it may select these unintended defaults.Changes
INBUILT_TOOL_NAMES(frozenset) ininbuilt_tools.pyto centrally define default tool namesinclude_default_tools: bool = Trueparameter toLLMAgent.__init__()True(default): preserves existing behavior (fully backward compatible)False: filters out inbuilt tools (move_one_step,teleport_to_location,speak_to) from the agent’sToolManager, leaving only user-registered toolsImplementation Note
Filtering is applied after tool registration, ensuring compatibility with the existing tool registration flow while allowing selective removal of default tools per agent.
Usage