> ## 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.interpreters.ipython interpreter

<a id="camel.interpreters.ipython_interpreter" />

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter" />

## JupyterKernelInterpreter

```python theme={"system"}
class JupyterKernelInterpreter(BaseInterpreter):
```

A class for executing code strings in a Jupyter Kernel.

**Parameters:**

* **require\_confirm** (bool, optional): If `True`, prompt user before running code strings for security. Defaults to `True`.
* **print\_stdout** (bool, optional): If `True`, print the standard output of the executed code. Defaults to `False`.
* **print\_stderr** (bool, optional): If `True`, print the standard error of the executed code. Defaults to `True`.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    require_confirm: bool = True,
    print_stdout: bool = False,
    print_stderr: bool = True
):
```

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter.__del__" />

### **del**

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

Clean up the kernel and client.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter._initialize_if_needed" />

### \_initialize\_if\_needed

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

Initialize the kernel manager and client if they are not already
initialized.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter._clean_ipython_output" />

### \_clean\_ipython\_output

```python theme={"system"}
def _clean_ipython_output(output: str):
```

Remove ANSI escape sequences from the output.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter._execute" />

### \_execute

```python theme={"system"}
def _execute(self, code: str, timeout: float):
```

Execute the code in the Jupyter kernel and return the result.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter.run" />

### run

```python theme={"system"}
def run(self, code: str, code_type: str = 'python'):
```

Executes the given code in the Jupyter kernel.

**Parameters:**

* **code** (str): The code string to execute.
* **code\_type** (str): The type of code to execute (e.g., 'python', 'bash'). (default: obj:`python`)

**Returns:**

str: A string containing the captured result of the
executed code.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter.execute_command" />

### execute\_command

```python theme={"system"}
def execute_command(self, command: str):
```

Executes a shell command in the Jupyter kernel.

**Parameters:**

* **command** (str): The shell command to execute.

**Returns:**

str: A string containing the captured result of the
executed command.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter.supported_code_types" />

### supported\_code\_types

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

**Returns:**

List\[str]: Supported code types.

<a id="camel.interpreters.ipython_interpreter.JupyterKernelInterpreter.update_action_space" />

### update\_action\_space

```python theme={"system"}
def update_action_space(self, action_space: Dict[str, Any]):
```

Updates the action space for the interpreter.

**Parameters:**

* **action\_space** (Dict\[str, Any]): A dictionary representing the new or updated action space.
