agentscope.service.execute_code.exec_shell module

Service to execute shell commands.

agentscope.service.execute_code.exec_shell.execute_shell_command(command: str) ServiceResponse[源代码]

Executes a given shell command.

参数:

command (str) – The shell command to execute.

返回:

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

返回类型:

ServiceResponse

备注

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).