Add timeout parameter to bash tool for hard timeout control (#8106)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
This commit is contained in:
Graham Neubig
2025-05-15 01:24:42 -04:00
committed by GitHub
parent 3ca585b79f
commit e4c284f96d
3 changed files with 32 additions and 3 deletions

View File

@@ -93,6 +93,15 @@ def response_to_actions(
is_input = arguments.get('is_input', 'false') == 'true'
action = CmdRunAction(command=arguments['command'], is_input=is_input)
# Set hard timeout if provided
if 'timeout' in arguments:
try:
action.set_hard_timeout(float(arguments['timeout']))
except ValueError as e:
raise FunctionCallValidationError(
f"Invalid float passed to 'timeout' argument: {arguments['timeout']}"
) from e
# ================================================
# IPythonTool (Jupyter)
# ================================================