> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.toolkits.code execution

<a id="camel.toolkits.code_execution" />

<a id="camel.toolkits.code_execution.CodeExecutionToolkit" />

## CodeExecutionToolkit

```python theme={"system"}
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** (bool): Whether to require confirmation before executing code. (default: :obj:`False`)
* **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__" />

### **init**

```python theme={"system"}
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: bool = False,
    timeout: Optional[float] = None,
    microsandbox_config: Optional[dict] = None
):
```

<a id="camel.toolkits.code_execution.CodeExecutionToolkit.execute_code" />

### execute\_code

```python theme={"system"}
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" />

### execute\_command

```python theme={"system"}
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" />

### get\_tools

```python theme={"system"}
def get_tools(self):
```

**Returns:**

List\[FunctionTool]: A list of FunctionTool objects
representing the functions in the toolkit.
