fix(langchain_v1): only interrupt if at least one ToolConfig value is True (#33064)

**Description:** Right now, we interrupt even if the provided ToolConfig
has all false values. We should ignore ToolConfigs which do not have at
least one value marked as true (just as we would if tool_name: False was
passed into the dict).
This commit is contained in:
nhuang-lc
2025-09-23 14:20:34 -07:00
committed by GitHub
parent 89079ad411
commit 48b05224ad

View File

@@ -138,7 +138,13 @@ class HumanInTheLoopMiddleware(AgentMiddleware):
allow_edit=True,
allow_respond=True,
)
else:
elif any(
[
tool_config.get("allow_accept", False),
tool_config.get("allow_edit", False),
tool_config.get("allow_respond", False),
]
):
resolved_tool_configs[tool_name] = tool_config
self.tool_configs = resolved_tool_configs
self.description_prefix = description_prefix