🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
Auto-update documentation after merge [skip ci]
camel-docs-bot87dc9f2275cf
diff --git a/docs/mintlify/reference/camel.interpreters.subprocess_interpreter.mdx b/docs/mintlify/reference/camel.interpreters.subprocess_interpreter.mdxindex fe3d851e1..f7f89b2f9 100644--- a/docs/mintlify/reference/camel.interpreters.subprocess_interpreter.mdx+++ b/docs/mintlify/reference/camel.interpreters.subprocess_interpreter.mdx@@ -105,6 +105,21 @@ Creates a temporary file with the given code and extension.def _check_code_type(self, code_type: str):```+<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter._confirm_execution"></a>++### _confirm_execution++```python+def _confirm_execution(+ self,+ message: str,+ prompt: str,+ declined_message: str+):+```++Prompt the user before executing local subprocess work.+<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter.supported_code_types"></a>### supported_code_typesdiff --git a/docs/mintlify/reference/camel.toolkits.code_execution.mdx b/docs/mintlify/reference/camel.toolkits.code_execution.mdxindex 376064115..cebfc25bd 100644--- a/docs/mintlify/reference/camel.toolkits.code_execution.mdx+++ b/docs/mintlify/reference/camel.toolkits.code_execution.mdx@@ -16,7 +16,7 @@ A toolkit for code execution.- **verbose** (bool): Whether to print the output of the code execution. (default: :obj:`False`)- **unsafe_mode** (bool): If `True`, the interpreter runs the code by `eval()` without any security check. (default: :obj:`False`)- **import_white_list** (Optional[List[str]]): A list of allowed imports. (default: :obj:`None`)-- **require_confirm** (Optional[bool]): Whether to require confirmation before executing code. If None, subprocess execution requires confirmation by default. (default: :obj:`None`)+- **require_confirm** (Optional[bool]): Whether to require confirmation before executing code. If `None`, subprocess execution requires confirmation by default. (default: :obj:`None`)- **timeout** (Optional[float]): General timeout for toolkit operations. (default: :obj:`None`)- **microsandbox_config** (Optional[dict]): Configuration for microsandbox interpreter. Available keys: 'server_url', 'api_key', 'namespace', 'sandbox_name', 'timeout'. If None, uses default configuration. (default: :obj:`None`)diff --git a/docs/reference/camel.interpreters.subprocess_interpreter.md b/docs/reference/camel.interpreters.subprocess_interpreter.mdnew file mode 100644index 000000000..fe3d851e1--- /dev/null+++ b/docs/reference/camel.interpreters.subprocess_interpreter.md@@ -0,0 +1,163 @@+<a id="camel.interpreters.subprocess_interpreter"></a>++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter"></a>++## SubprocessInterpreter++```python+class SubprocessInterpreter(BaseInterpreter):+```++SubprocessInterpreter is a class for executing code files or code+strings in a subprocess.++This class handles the execution of code in different scripting languages+(currently Python and Bash) within a subprocess, capturing their+stdout and stderr streams, and allowing user checking before executing code+strings or shell commands.++**Parameters:**++- **require_confirm** (bool, optional): If True, prompt user before running code strings or shell commands for security. (default: :obj:`True`)+- **print_stdout** (bool, optional): If True, print the standard output of the executed code. (default: :obj:`False`)+- **print_stderr** (bool, optional): If True, print the standard error of the executed code. (default: :obj:`True`)+- **execution_timeout** (int, optional): Maximum time in seconds to wait for code execution to complete. (default: :obj:`60`)++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter.__init__"></a>++### __init__++```python+def __init__(+ self,+ require_confirm: bool = True,+ print_stdout: bool = False,+ print_stderr: bool = True,+ execution_timeout: int = 60+):+```++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter.run_file"></a>++### run_file++```python+def run_file(self, file: Path, code_type: str = 'python'):+```++Executes a code file in a subprocess and captures its output.++**Parameters:**++- **file** (Path): The path object of the file to run.+- **code_type** (str): The type of code to execute (e.g., 'python', 'bash'). (default: obj:`python`)++**Returns:**++ str: A string containing the captured stdout and stderr of the+executed code.++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter.run"></a>++### run++```python+def run(self, code: str, code_type: str):+```++Generates a temporary file with the given code, executes it, and+deletes the file afterward.++**Parameters:**++- **code** (str): The code string to execute.+- **code_type** (str): The type of code to execute (e.g., 'python', 'bash').++**Returns:**++ str: A string containing the captured stdout and stderr of the+executed code.++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter._create_temp_file"></a>++### _create_temp_file++```python+def _create_temp_file(self, code: str, extension: str):+```++Creates a temporary file with the given code and extension.++**Parameters:**++- **code** (str): The code to write to the temporary file.+- **extension** (str): The file extension to use.++**Returns:**++ Path: The path to the created temporary file.++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter._check_code_type"></a>++### _check_code_type++```python+def _check_code_type(self, code_type: str):+```++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter.supported_code_types"></a>++### supported_code_types++```python+def supported_code_types(self):+```++Provides supported code types by the interpreter.++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter.update_action_space"></a>++### update_action_space++```python+def update_action_space(self, action_space: Dict[str, Any]):+```++Updates action space for *python* interpreter++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter._is_command_available"></a>++### _is_command_available++```python+def _is_command_available(self, command: str):+```++Check if a command is available in the system PATH.++**Parameters:**++- **command** (str): The command to check.++**Returns:**++ bool: True if the command is available, False otherwise.++<a id="camel.interpreters.subprocess_interpreter.SubprocessInterpreter.execute_command"></a>++### execute_command++```python+def execute_command(self, command: str):+```++Executes a shell command in a subprocess and captures its output.++**Parameters:**++- **command** (str): The shell command to execute.++**Returns:**++ tuple: A tuple containing the captured stdout and stderr of the+executed command.diff --git a/docs/reference/camel.toolkits.code_execution.md b/docs/reference/camel.toolkits.code_execution.mdnew file mode 100644index 000000000..376064115--- /dev/null+++ b/docs/reference/camel.toolkits.code_execution.md@@ -0,0 +1,89 @@+<a id="camel.toolkits.code_execution"></a>++<a id="camel.toolkits.code_execution.CodeExecutionToolkit"></a>++## CodeExecutionToolkit++```python+class CodeExecutionToolkit(BaseToolkit):+```++A toolkit for code execution.++**Parameters:**++- **sandbox** (str): The environment type used to execute code. (default: `subprocess`)+- **verbose** (bool): Whether to print the output of the code execution. (default: :obj:`False`)+- **unsafe_mode** (bool): If `True`, the interpreter runs the code by `eval()` without any security check. (default: :obj:`False`)+- **import_white_list** (Optional[List[str]]): A list of allowed imports. (default: :obj:`None`)+- **require_confirm** (Optional[bool]): Whether to require confirmation before executing code. If None, subprocess execution requires confirmation by default. (default: :obj:`None`)+- **timeout** (Optional[float]): General timeout for toolkit operations. (default: :obj:`None`)+- **microsandbox_config** (Optional[dict]): Configuration for microsandbox interpreter. Available keys: 'server_url', 'api_key', 'namespace', 'sandbox_name', 'timeout'. If None, uses default configuration. (default: :obj:`None`)++<a id="camel.toolkits.code_execution.CodeExecutionToolkit.__init__"></a>++### __init__++```python+def __init__(+ self,+ sandbox: Literal['internal_python', 'jupyter', 'docker', 'subprocess', 'e2b', 'microsandbox'] = 'subprocess',+ verbose: bool = False,+ unsafe_mode: bool = False,+ import_white_list: Optional[List[str]] = None,+ require_confirm: Optional[bool] = None,+ timeout: Optional[float] = None,+ microsandbox_config: Optional[dict] = None+):+```++<a id="camel.toolkits.code_execution.CodeExecutionToolkit.execute_code"></a>++### execute_code++```python+def execute_code(self, code: str, code_type: str = 'python'):+```++Execute a given code snippet.++**Parameters:**++- **code** (str): The input code to the Code Interpreter tool call.+- **code_type** (str): The type of the code to be executed (e.g. node.js, python, etc). (default: obj:`python`)++**Returns:**++ str: The text output from the Code Interpreter tool call.++<a id="camel.toolkits.code_execution.CodeExecutionToolkit.execute_command"></a>++### execute_command++```python+def execute_command(self, command: str):+```++Execute a command can be used to resolve the dependency of the+code. Useful if there's dependency issues when you try to execute code.++**Parameters:**++- **command** (str): The command to execute.++**Returns:**++ Union[str, tuple[str, str]]: The output of the command.++<a id="camel.toolkits.code_execution.CodeExecutionToolkit.get_tools"></a>++### get_tools++```python+def get_tools(self):+```++**Returns:**++ List[FunctionTool]: A list of FunctionTool objects+representing the functions in the toolkit.