feat: add tool_modules parameter for selective built-in module loading - #87
Open
MiteshSoni01 wants to merge 4 commits into
Open
feat: add tool_modules parameter for selective built-in module loading#87MiteshSoni01 wants to merge 4 commits into
MiteshSoni01 wants to merge 4 commits into
Conversation
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.
Purpose
Add a
tool_modulesparameter toROSAToolsandROSAthat allows selective loading of built-in tool modules. This enables purpose-built agents to disable unused ROS introspection tools, significantly reducing prompt token overhead.Proposed Changes
tool_modulesparameter toROSATools.__init__with full docstring,ALL_MODULES/DEFAULT_MODULESconstants, selective module loading logic, andUserWarningfor unknown module namestool_modulesparameter toROSA.__init__and_get_tools()with updated class docstring and usage examplesSetto typing imports inrosa.py_get_tools()docstring with new parameter documentedTestROSAToolModulestest class with 6 tests covering: empty set, None default, selective loading, unknown module warning, default behaviour, and custom tools with empty modulesIssues
No existing issue - proposing new feature based on real-world deployment need.
Testing
All 6 new tests pass on ROS1 Noetic, Python 3.10.14, Jetson Orin NX hardware:
Note:
TestROSATools::test_adds_default_toolsfails on the upstreammainbranch before our changes - confirmed pre-existing issue unrelated to this PR.Real-world impact: Tested on ROS1 Noetic on Jetson Orin NX hardware. Disabling unused built-in modules reduced prompt tokens by 50-78% per query (from ~10,000 to ~2,400-4,800 tokens), significantly reducing latency and API cost for production deployments.
Usage:
Disable all built-in tools - use only custom tools
agent = ROSA(ros_version=1, llm=llm, tool_packages=[my_tools], tool_modules=set())
Load only specific built-in modules
agent = ROSA(ros_version=1, llm=llm, tool_modules={"calculation", "system"})
Default behaviour unchanged
agent = ROSA(ros_version=1, llm=llm)
Backwards compatible:
tool_modules=None(default) preserves existing behaviour exactly.