feat: Fix required tools being terminal (#3010)

This commit is contained in:
Matthew Zhou
2025-06-24 17:46:37 -07:00
committed by GitHub
parent 11e4010380
commit d4555d6183
2 changed files with 2 additions and 4 deletions

View File

@@ -141,9 +141,7 @@ class ToolRulesSolver(BaseModel):
def is_terminal_tool(self, tool_name: str) -> bool:
"""Check if the tool is defined as a terminal tool in the terminal tool rules or required-before-exit tool rules."""
return any(rule.tool_name == tool_name for rule in self.terminal_tool_rules) or any(
rule.tool_name == tool_name for rule in self.required_before_exit_tool_rules
)
return any(rule.tool_name == tool_name for rule in self.terminal_tool_rules)
def has_children_tools(self, tool_name):
"""Check if the tool has children tools"""

View File

@@ -967,7 +967,7 @@ async def test_required_tools_called_during_normal_flow(server, disable_e2b_api_
tools = [save_data_tool]
tool_rules = [
InitToolRule(tool_name="save_data"),
RequiredBeforeExitToolRule(tool_name="send_message"),
RequiredBeforeExitToolRule(tool_name="save_data"),
TerminalToolRule(tool_name="send_message"),
]