Skip to main content

Workflows & automation

n8n

Add a sandboxed code step to any n8n workflow. The E2B node runs commands, moves files and works with git in an isolated sandbox, not on your n8n instance.

Maintained by
E2B
How it works
Verified n8n node
Package
@e2b/n8n-nodes-e2b
Language
No code

Set it up

Get started

Paste the prompt into your coding agent, or follow the steps yourself.

Paste this into your coding agent

Add an E2B code step to this n8n workflow.

  1. 1.Make sure the E2B node (@e2b/n8n-nodes-e2b) is installed on the n8n instance.
  2. 2.The node needs an E2B API credential. If there isn't one, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it in the workflow.
  3. 3.Follow the examples at https://github.com/e2b-dev/n8n-nodes-e2b/tree/main/docs/examples and add a Code > Run Command step with Kill After Run enabled.
  4. 4.Run the workflow once and show me the stdout that came from the sandbox.

Or set it up yourself

  1. 1. Install the E2B node

    @e2b/n8n-nodes-e2b
  2. 2. Add your API key

    Credential: E2B API
    API Key: e2b_...
  3. 3. Run a command in a sandbox

    {
      "type": "@e2b/n8n-nodes-e2b.e2b",
      "parameters": {
        "resource": "code",
        "operation": "runCommand",
        "sandboxId": "",
        "command": "python3 -c \"print('Hello from an E2B sandbox!')\"",
        "allowInternetAccess": true,
        "killAfterRun": true
      }
    }

Security

What runs in the sandbox

Commands from your workflow run in an isolated sandbox, away from the machine running n8n.

  • CodeShell commands from the Run Command operation, plus file and git operations on the sandbox.
  • LifetimeLeave Sandbox ID empty and enable Kill After Run for a throwaway sandbox per step.
  • StateCreate, pause and reuse a sandbox across steps, or keep data in snapshots and volumes.
  • NetworkInternet access is a per-step option. Turn it off for locked-down runs.

3B+ sandboxes started

Give every agent a machine