The process-global _last_resolved_tool_names gets overwritten when subagents resolve their own toolsets, causing execute_code in the parent agent to generate imports for the wrong set of tools. Fix: handle_function_call() now accepts an enabled_tools parameter. run_agent.py already passes self.valid_tool_names at both call sites. This change makes model_tools.py actually use it, falling back to the global only when the caller doesn't provide a list (backward compat).
13 KiB
13 KiB