Skip to content

feat: add tool_modules parameter for selective built-in module loading - #87

Open
MiteshSoni01 wants to merge 4 commits into
nasa-jpl:mainfrom
MiteshSoni01:feat/optional-tool-modules
Open

feat: add tool_modules parameter for selective built-in module loading#87
MiteshSoni01 wants to merge 4 commits into
nasa-jpl:mainfrom
MiteshSoni01:feat/optional-tool-modules

Conversation

@MiteshSoni01

@MiteshSoni01 MiteshSoni01 commented Jun 15, 2026

Copy link
Copy Markdown

Purpose

Add a tool_modules parameter to ROSATools and ROSA that 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

  • [ADD] tool_modules parameter to ROSATools.__init__ with full docstring, ALL_MODULES/DEFAULT_MODULES constants, selective module loading logic, and UserWarning for unknown module names
  • [ADD] tool_modules parameter to ROSA.__init__ and _get_tools() with updated class docstring and usage examples
  • [ADD] Set to typing imports in rosa.py
  • [ADD] Restored and updated _get_tools() docstring with new parameter documented
  • [ADD] TestROSAToolModules test class with 6 tests covering: empty set, None default, selective loading, unknown module warning, default behaviour, and custom tools with empty modules

Issues

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:

  • TestROSAToolModules::test_custom_tools_work_with_empty_tool_modules PASSED
  • TestROSAToolModules::test_empty_tool_modules_loads_no_builtin_tools PASSED
  • TestROSAToolModules::test_none_tool_modules_loads_all_builtin_tools PASSED
  • TestROSAToolModules::test_selective_tool_modules_loads_only_specified PASSED
  • TestROSAToolModules::test_tool_modules_defaults_to_all PASSED
  • TestROSAToolModules::test_unknown_module_raises_warning PASSED

Note: TestROSATools::test_adds_default_tools fails on the upstream main branch 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.

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.

1 participant