mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: increase default timeout for code execution sandbox
- Updated the default timeout for sandbox script execution from 120 seconds to 300 seconds (5 minutes) to allow longer-running scripts. - Enhanced comments in the code execution tool to clarify the timeout duration. - Suppressed stdout and stderr output from internal tool handlers during execution to prevent clutter in the CLI interface.
This commit is contained in:
parent
273b367f05
commit
3b90fa5c9b
2 changed files with 16 additions and 6 deletions
|
|
@ -46,7 +46,7 @@ SANDBOX_ALLOWED_TOOLS = frozenset([
|
|||
])
|
||||
|
||||
# Resource limit defaults (overridable via config.yaml → code_execution.*)
|
||||
DEFAULT_TIMEOUT = 120 # seconds
|
||||
DEFAULT_TIMEOUT = 300 # 5 minutes
|
||||
DEFAULT_MAX_TOOL_CALLS = 50
|
||||
MAX_STDOUT_BYTES = 50_000 # 50 KB
|
||||
MAX_STDERR_BYTES = 10_000 # 10 KB
|
||||
|
|
@ -255,11 +255,21 @@ def _rpc_server_loop(
|
|||
for param in _TERMINAL_BLOCKED_PARAMS:
|
||||
tool_args.pop(param, None)
|
||||
|
||||
# Dispatch through the standard tool handler
|
||||
# Dispatch through the standard tool handler.
|
||||
# Suppress stdout/stderr from internal tool handlers so
|
||||
# their status prints don't leak into the CLI spinner.
|
||||
try:
|
||||
result = handle_function_call(
|
||||
tool_name, tool_args, task_id=task_id
|
||||
)
|
||||
_real_stdout, _real_stderr = sys.stdout, sys.stderr
|
||||
sys.stdout = open(os.devnull, "w")
|
||||
sys.stderr = open(os.devnull, "w")
|
||||
try:
|
||||
result = handle_function_call(
|
||||
tool_name, tool_args, task_id=task_id
|
||||
)
|
||||
finally:
|
||||
sys.stdout.close()
|
||||
sys.stderr.close()
|
||||
sys.stdout, sys.stderr = _real_stdout, _real_stderr
|
||||
except Exception as exc:
|
||||
result = json.dumps({"error": str(exc)})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue