@mastra/e2b 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +15 -0
- package/README.md +68 -0
- package/dist/index.cjs +858 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +855 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/index.d.ts +253 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/mounts/gcs.d.ts +20 -0
- package/dist/sandbox/mounts/gcs.d.ts.map +1 -0
- package/dist/sandbox/mounts/index.d.ts +4 -0
- package/dist/sandbox/mounts/index.d.ts.map +1 -0
- package/dist/sandbox/mounts/s3.d.ts +30 -0
- package/dist/sandbox/mounts/s3.d.ts.map +1 -0
- package/dist/sandbox/mounts/types.d.ts +36 -0
- package/dist/sandbox/mounts/types.d.ts.map +1 -0
- package/dist/utils/shell-quote.d.ts +8 -0
- package/dist/utils/shell-quote.d.ts.map +1 -0
- package/dist/utils/template.d.ts +84 -0
- package/dist/utils/template.d.ts.map +1 -0
- package/package.json +70 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @mastra/e2b
|
|
2
|
+
|
|
3
|
+
E2B cloud sandbox provider for Mastra workspaces. Provides secure, isolated code execution environments with support for mounting cloud storage.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mastra/e2b
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Agent } from '@mastra/core/agent';
|
|
15
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
16
|
+
import { E2BSandbox } from '@mastra/e2b';
|
|
17
|
+
|
|
18
|
+
const workspace = new Workspace({
|
|
19
|
+
sandbox: new E2BSandbox({
|
|
20
|
+
apiKey: 'my-api-key', // falls back to E2B_API_KEY env var
|
|
21
|
+
timeout: 60_000, // 60 second timeout (default: 5 minutes)
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const agent = new Agent({
|
|
26
|
+
name: 'my-agent',
|
|
27
|
+
model: 'anthropic/claude-opus-4-5',
|
|
28
|
+
workspace,
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Mounting Cloud Storage
|
|
33
|
+
|
|
34
|
+
E2B sandboxes can mount S3 or GCS filesystems, making cloud storage accessible as a local directory inside the sandbox:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
38
|
+
import { S3Filesystem } from '@mastra/s3';
|
|
39
|
+
import { E2BSandbox } from '@mastra/e2b';
|
|
40
|
+
|
|
41
|
+
const workspace = new Workspace({
|
|
42
|
+
mounts: {
|
|
43
|
+
'/data': new S3Filesystem({
|
|
44
|
+
bucket: 'my-bucket',
|
|
45
|
+
region: 'us-east-1',
|
|
46
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
47
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
sandbox: new E2BSandbox(),
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Custom Templates
|
|
55
|
+
|
|
56
|
+
For advanced use cases, you can use custom E2B templates:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const workspace = new Workspace({
|
|
60
|
+
sandbox: new E2BSandbox({
|
|
61
|
+
template: 'my-custom-template',
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
For more information, see the [Mastra Workspaces documentation](https://mastra.ai/docs/workspace/overview).
|