From e6a2fd3fd4a7bb8469cf7416bc4d7f61687d83ea Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Fri, 24 Jan 2025 09:43:34 -0500 Subject: [PATCH] feat: add prompt to prevent agent execute multiple bash command at the same time (#6428) --- openhands/agenthub/codeact_agent/function_calling.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openhands/agenthub/codeact_agent/function_calling.py b/openhands/agenthub/codeact_agent/function_calling.py index 08709c9ee526..6232e0300b73 100644 --- a/openhands/agenthub/codeact_agent/function_calling.py +++ b/openhands/agenthub/codeact_agent/function_calling.py @@ -32,6 +32,7 @@ _BASH_DESCRIPTION = """Execute a bash command in the terminal. * Long running commands: For commands that may run indefinitely, it should be run in the background and the output should be redirected to a file, e.g. command = `python3 app.py > server.log 2>&1 &`. * Interact with running process: If a bash command returns exit code `-1`, this means the process is not yet finished. By setting `is_input` to `true`, the assistant can interact with the running process and send empty `command` to retrieve any additional logs, or send additional text (set `command` to the text) to STDIN of the running process, or send command like `C-c` (Ctrl+C), `C-d` (Ctrl+D), `C-z` (Ctrl+Z) to interrupt the process. +* One command at a time: You can only execute one bash command at a time. If you need to run multiple commands sequentially, you can use `&&` or `;` to chain them together. """ CmdRunTool = ChatCompletionToolParam( @@ -44,7 +45,7 @@ 'properties': { 'command': { 'type': 'string', - 'description': 'The bash command to execute. Can be empty string to view additional logs when previous exit code is `-1`. Can be `C-c` (Ctrl+C) to interrupt the currently running process.', + 'description': 'The bash command to execute. Can be empty string to view additional logs when previous exit code is `-1`. Can be `C-c` (Ctrl+C) to interrupt the currently running process. Note: You can only execute one bash command at a time. If you need to run multiple commands sequentially, you can use `&&` or `;` to chain them together.', }, 'is_input': { 'type': 'string',