Don't pass sanitize_inputs_outputs=True to managed agents (#85)

This commit is contained in:
Tom McKenzie 2025-01-06 10:27:10 -08:00 committed by GitHub
parent 0824785b7a
commit ff8e20d93f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 6 deletions

View File

@ -388,16 +388,22 @@ class MultiStepAgent:
try:
if isinstance(arguments, str):
observation = available_tools[tool_name].__call__(
arguments, sanitize_inputs_outputs=True
)
if tool_name in self.managed_agents:
observation = available_tools[tool_name].__call__(arguments)
else:
observation = available_tools[tool_name].__call__(
arguments, sanitize_inputs_outputs=True
)
elif isinstance(arguments, dict):
for key, value in arguments.items():
if isinstance(value, str) and value in self.state:
arguments[key] = self.state[value]
observation = available_tools[tool_name].__call__(
**arguments, sanitize_inputs_outputs=True
)
if tool_name in self.managed_agents:
observation = available_tools[tool_name].__call__(**arguments)
else:
observation = available_tools[tool_name].__call__(
**arguments, sanitize_inputs_outputs=True
)
else:
error_msg = f"Arguments passed to tool should be a dict or string: got a {type(arguments)}."
raise AgentExecutionError(error_msg)