🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@mastra/e2b

Package Overview
Dependencies
Maintainers
1
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons
This package has malicious versions linked to the ongoing "Mastra AI framework compromise" supply chain attack.

Affected versions:

0.3.4
View campaign page

@mastra/e2b

E2B cloud sandbox provider for Mastra workspaces

unpublished
Source
npmnpm
Version
0.3.4
Version published
Weekly downloads
6.1K
-24.19%
Maintainers
1
Weekly downloads
 
Created
Source

@mastra/e2b

E2B cloud sandbox provider for Mastra workspaces. Provides secure, isolated code execution environments with support for mounting cloud storage.

Installation

npm install @mastra/e2b

Usage

import { Agent } from '@mastra/core/agent';
import { Workspace } from '@mastra/core/workspace';
import { E2BSandbox } from '@mastra/e2b';

const workspace = new Workspace({
  sandbox: new E2BSandbox({
    apiKey: 'my-api-key', // falls back to E2B_API_KEY env var
    timeout: 60_000, // 60 second timeout (default: 5 minutes)
  }),
});

const agent = new Agent({
  name: 'my-agent',
  model: 'anthropic/claude-opus-4-5',
  workspace,
});

Mounting Cloud Storage

E2B sandboxes can mount S3, GCS, or Azure Blob filesystems, making cloud storage accessible as a local directory inside the sandbox:

import { Workspace } from '@mastra/core/workspace';
import { S3Filesystem } from '@mastra/s3';
import { AzureBlobFilesystem } from '@mastra/azure/blob';
import { E2BSandbox } from '@mastra/e2b';

const workspace = new Workspace({
  mounts: {
    '/data': new S3Filesystem({
      bucket: 'my-bucket',
      region: 'us-east-1',
      accessKeyId: process.env.AWS_ACCESS_KEY_ID,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
    }),
    '/azure-data': new AzureBlobFilesystem({
      container: 'my-container',
      connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING,
      prefix: 'workspace/data',
    }),
  },
  sandbox: new E2BSandbox(),
});

Custom Templates

For advanced use cases, you can use custom E2B templates:

const workspace = new Workspace({
  sandbox: new E2BSandbox({
    template: 'my-custom-template',
  }),
});

Documentation

For more information, see the Mastra Workspaces documentation.

FAQs

Package last updated on 17 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts