agentscope.service.execute_code.exec_shell module

Service to execute shell commands.

agentscope.service.execute_code.exec_shell.execute_shell_command(command: str) ServiceResponse[source]

Executes a given shell command.

Parameters:

command (str) – The shell command to execute.

Returns:

Contains either the output from the shell command as a string if sucessful, or an error message include the error type.

Return type:

ServiceResponse

Note

Use any bash/shell commands you want (e.g. find, grep, cat, ls), but note that : 1. interactive session commands (e.g. python, vim) or commands that change current state (e.g. cd that change the current directory) are NOT supported yet, so please do not invoke them. 2. be VERY CAREFUL when using commands that will change/edit the files current directory (e.g. rm, sed).