Agents: Avoid calling tools that haven't been explicitly enabled

This commit is contained in:
Aidan Do 2024-12-21 22:40:29 +11:00
parent bae197c37e
commit 8119363e56

View file

@ -539,7 +539,7 @@ class ChatAgent(ShieldRunnerMixin):
tool_call = message.tool_calls[0]
name = tool_call.tool_name
if not isinstance(name, BuiltinTool):
if not isinstance(name, BuiltinTool) or name not in enabled_tools:
yield message
return