Node Details

  • Name: Code Interpreter by E2B

  • Type: CodeInterpreter

  • Version: 1.0

  • Category: Tools

Parameters

Inputs

  1. Tool Name

    • Type: string

    • Default: “code_interpreter”

    • Description: Specifies the name of the tool

  2. Tool Description

    • Type: string

    • Default: A detailed description of the tool’s capabilities

    • Description: Specifies the description of the tool

Credential

  • Label: Connect Credential

  • Name: credential

  • Type: credential

  • Credential Names: E2BApi

  • Optional: true

Functionality

The node uses the E2B Code Interpreter API to execute Python code. Here’s how it works:

  1. It initializes with the provided tool name, description, and API key.

  2. When called, it takes Python code as input.

  3. The code is executed in a sandbox environment.

  4. The execution results, including text output and generated artifacts (like images or HTML), are processed.

  5. The results are returned, with artifacts being stored and referenced for later retrieval.

Input/Output

Input

  • Python code as a string

Output

  • Text output from code execution

  • References to generated artifacts (images, HTML, etc.)

Use Cases

This node is particularly useful for:

  1. Dynamic data analysis and visualization in chat interfaces

  2. Executing user-provided or AI-generated Python code safely

  3. Generating charts, graphs, or other visual data representations on-the-fly

  4. Performing complex calculations or data manipulations within a conversation flow

Important Notes

  • The node supports various output types, including PNG images, JPEG images, HTML, Markdown, LaTeX, JSON, and JavaScript.

  • Errors during code execution are caught and returned as part of the output.

  • The sandbox environment is closed after each execution to free up resources.

  • Artifacts generated during execution (e.g., images) are stored and can be retrieved later using the provided references.