@computesdk/e2b 1.0.0 → 1.1.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @computesdk/e2b
2
2
 
3
- E2B provider for ComputeSDK - Execute Python code in secure, isolated E2B sandboxes.
3
+ E2B provider for ComputeSDK - Execute code in secure, isolated E2B sandboxes with full filesystem and terminal support.
4
4
 
5
5
  ## Installation
6
6
 
@@ -19,223 +19,449 @@ export E2B_API_KEY=e2b_your_api_key_here
19
19
 
20
20
  ## Usage
21
21
 
22
- ### Basic Usage
22
+ ### With ComputeSDK
23
23
 
24
24
  ```typescript
25
+ import { compute } from 'computesdk';
25
26
  import { e2b } from '@computesdk/e2b';
26
27
 
27
- const provider = e2b();
28
+ // Set as default provider
29
+ compute.setConfig({
30
+ provider: e2b({ apiKey: process.env.E2B_API_KEY })
31
+ });
32
+
33
+ // Create sandbox
34
+ const sandbox = await compute.sandbox.create({});
28
35
 
29
36
  // Execute Python code
30
- const result = await provider.doExecute('print("Hello from E2B!")');
31
- console.log(result.stdout); // "Hello from E2B!"
37
+ const result = await sandbox.runCode(`
38
+ import pandas as pd
39
+ import numpy as np
40
+
41
+ data = {'A': [1, 2, 3], 'B': [4, 5, 6]}
42
+ df = pd.DataFrame(data)
43
+ print(df)
44
+ print(f"Sum: {df.sum().sum()}")
45
+ `);
46
+
47
+ console.log(result.stdout);
48
+ // Output:
49
+ // A B
50
+ // 0 1 4
51
+ // 1 2 5
52
+ // 2 3 6
53
+ // Sum: 21
54
+
55
+ // Clean up
56
+ await compute.sandbox.destroy(sandbox.sandboxId);
32
57
  ```
33
58
 
34
- ### With ComputeSDK
59
+ ### Direct Usage
35
60
 
36
61
  ```typescript
37
- import { executeSandbox } from 'computesdk';
38
62
  import { e2b } from '@computesdk/e2b';
39
63
 
40
- const result = await executeSandbox({
41
- sandbox: e2b(),
42
- code: 'print("Hello World")',
43
- runtime: 'python'
64
+ // Create provider
65
+ const provider = e2b({
66
+ apiKey: 'e2b_your_api_key',
67
+ timeout: 600000 // 10 minutes
44
68
  });
69
+
70
+ // Use with compute singleton
71
+ const sandbox = await compute.sandbox.create({ provider });
45
72
  ```
46
73
 
47
- ### Configuration
74
+ ## Configuration
48
75
 
49
- ```typescript
50
- import { e2b } from '@computesdk/e2b';
76
+ ### Environment Variables
51
77
 
52
- const provider = e2b({
53
- timeout: 300000, // 5 minutes (default)
54
- runtime: 'python' // Only Python is supported
55
- });
78
+ ```bash
79
+ export E2B_API_KEY=e2b_your_api_key_here
56
80
  ```
57
81
 
58
- ## API Reference
82
+ ### Configuration Options
59
83
 
60
- ### `e2b(config?: SandboxConfig)`
84
+ ```typescript
85
+ interface E2BConfig {
86
+ /** E2B API key - if not provided, will use E2B_API_KEY env var */
87
+ apiKey?: string;
88
+ /** Default runtime environment */
89
+ runtime?: 'python' | 'node';
90
+ /** Execution timeout in milliseconds */
91
+ timeout?: number;
92
+ }
93
+ ```
61
94
 
62
- Creates a new E2B provider instance.
95
+ ## Features
63
96
 
64
- #### Parameters
97
+ - ✅ **Code Execution** - Python and Node.js runtime support
98
+ - ✅ **Command Execution** - Run shell commands in sandbox
99
+ - ✅ **Filesystem Operations** - Full file system access via E2B API
100
+ - ✅ **Terminal Support** - Interactive PTY terminals
101
+ - ✅ **Auto Runtime Detection** - Automatically detects Python vs Node.js
102
+ - ✅ **Data Science Ready** - Pre-installed pandas, numpy, matplotlib, etc.
65
103
 
66
- - `config` (optional): Configuration object
67
- - `timeout`: Execution timeout in milliseconds (default: 300000)
68
- - `runtime`: Runtime environment - only `'python'` is supported
104
+ ## API Reference
69
105
 
70
- #### Returns
106
+ ### Code Execution
71
107
 
72
- `E2BProvider` instance implementing the `ComputeSpecification` interface.
108
+ ```typescript
109
+ // Execute Python code
110
+ const result = await sandbox.runCode(`
111
+ import json
112
+ data = {"message": "Hello from Python"}
113
+ print(json.dumps(data))
114
+ `, 'python');
115
+
116
+ // Execute Node.js code
117
+ const result = await sandbox.runCode(`
118
+ const data = { message: "Hello from Node.js" };
119
+ console.log(JSON.stringify(data));
120
+ `, 'node');
121
+
122
+ // Auto-detection (based on code patterns)
123
+ const result = await sandbox.runCode('print("Auto-detected as Python")');
124
+ ```
73
125
 
74
- ### Provider Methods
126
+ ### Command Execution
75
127
 
76
- #### `doExecute(code: string, runtime?: Runtime): Promise<ExecutionResult>`
128
+ ```typescript
129
+ // List files
130
+ const result = await sandbox.runCommand('ls', ['-la']);
77
131
 
78
- Execute Python code in the E2B sandbox.
132
+ // Install packages
133
+ const result = await sandbox.runCommand('pip', ['install', 'requests']);
79
134
 
80
- ```typescript
81
- const result = await provider.doExecute('x = 1 + 1\nprint(x)');
82
- // result.stdout: "2"
83
- // result.stderr: ""
84
- // result.exitCode: 0
135
+ // Run scripts
136
+ const result = await sandbox.runCommand('python', ['script.py']);
85
137
  ```
86
138
 
87
- #### `doKill(): Promise<void>`
88
-
89
- Terminates the E2B sandbox session.
139
+ ### Filesystem Operations
90
140
 
91
141
  ```typescript
92
- await provider.doKill();
93
- ```
142
+ // Write file
143
+ await sandbox.filesystem.writeFile('/tmp/hello.py', 'print("Hello World")');
94
144
 
95
- #### `doGetInfo(): Promise<SandboxInfo>`
145
+ // Read file
146
+ const content = await sandbox.filesystem.readFile('/tmp/hello.py');
96
147
 
97
- Get information about the sandbox.
148
+ // Create directory
149
+ await sandbox.filesystem.mkdir('/tmp/data');
98
150
 
99
- ```typescript
100
- const info = await provider.doGetInfo();
101
- // info.provider: "e2b"
102
- // info.runtime: "python"
103
- // info.status: "running" | "stopped"
104
- ```
151
+ // List directory contents
152
+ const files = await sandbox.filesystem.readdir('/tmp');
105
153
 
106
- ## Error Handling
154
+ // Check if file exists
155
+ const exists = await sandbox.filesystem.exists('/tmp/hello.py');
107
156
 
108
- The provider includes comprehensive error handling:
157
+ // Remove file or directory
158
+ await sandbox.filesystem.remove('/tmp/hello.py');
159
+ ```
109
160
 
110
- ### Authentication Errors
161
+ ### Terminal Operations
111
162
 
112
163
  ```typescript
113
- // Missing API key
114
- Error: Missing E2B API key. Set E2B_API_KEY environment variable. Get your API key from https://e2b.dev/
164
+ // Create terminal
165
+ const terminal = await sandbox.terminal.create({
166
+ command: 'bash',
167
+ cols: 80,
168
+ rows: 24,
169
+ onData: (data: Uint8Array) => {
170
+ const output = new TextDecoder().decode(data);
171
+ console.log('Terminal output:', output);
172
+ }
173
+ });
174
+
175
+ // Write to terminal
176
+ await terminal.write('echo "Hello Terminal!"\n');
177
+
178
+ // Resize terminal
179
+ await terminal.resize(120, 30);
115
180
 
116
- // Invalid API key format
117
- Error: Invalid E2B API key format. E2B API keys should start with 'e2b_'. Check your E2B_API_KEY environment variable.
181
+ // Kill terminal
182
+ await terminal.kill();
118
183
 
119
- // Authentication failed
120
- Error: E2B authentication failed. Please check your E2B_API_KEY environment variable. Get your API key from https://e2b.dev/
184
+ // List all terminals
185
+ const terminals = await sandbox.terminal.list();
186
+
187
+ // Get terminal by ID
188
+ const existingTerminal = await sandbox.terminal.getById('terminal-id');
121
189
  ```
122
190
 
123
- ### Runtime Errors
191
+ ### Sandbox Management
124
192
 
125
193
  ```typescript
126
- // Unsupported runtime
127
- Error: E2B provider currently only supports Python runtime
194
+ // Get sandbox info
195
+ const info = await sandbox.getInfo();
196
+ console.log(info.id, info.provider, info.status);
197
+
198
+ // Get existing sandbox (reconnect)
199
+ const existing = await compute.sandbox.getById(provider, 'sandbox-id');
200
+
201
+ // Destroy sandbox
202
+ await compute.sandbox.destroy(provider, 'sandbox-id');
203
+
204
+ // Note: E2B doesn't support listing all sandboxes
205
+ // Each sandbox is managed individually
206
+ ```
207
+
208
+ ## Runtime Detection
209
+
210
+ The provider automatically detects the runtime based on code patterns:
128
211
 
129
- // Execution timeout
130
- Error: E2B execution timeout (300000ms). Consider increasing the timeout or optimizing your code.
212
+ **Python indicators:**
213
+ - `print(` statements
214
+ - `import` statements
215
+ - `def` function definitions
216
+ - Python-specific syntax (`f"`, `__`, etc.)
131
217
 
132
- // Memory limits
133
- Error: E2B execution failed due to memory limits. Consider optimizing your code or using smaller data sets.
218
+ **Default:** Node.js for all other cases
219
+
220
+ ## Error Handling
221
+
222
+ ```typescript
223
+ try {
224
+ const result = await sandbox.runCode('invalid code');
225
+ } catch (error) {
226
+ if (error.message.includes('Missing E2B API key')) {
227
+ console.error('Set E2B_API_KEY environment variable');
228
+ } else if (error.message.includes('Invalid E2B API key format')) {
229
+ console.error('E2B API keys should start with "e2b_"');
230
+ } else if (error.message.includes('authentication failed')) {
231
+ console.error('Check your E2B API key');
232
+ } else if (error.message.includes('quota exceeded')) {
233
+ console.error('E2B usage limits reached');
234
+ } else if (error.message.includes('Syntax error')) {
235
+ console.error('Code has syntax errors');
236
+ }
237
+ }
134
238
  ```
135
239
 
136
- ### Quota Errors
240
+ ## Web Framework Integration
241
+
242
+ Use with web frameworks via the request handler:
137
243
 
138
244
  ```typescript
139
- // Quota exceeded
140
- Error: E2B quota exceeded. Please check your usage at https://e2b.dev/
245
+ import { handleComputeRequest } from 'computesdk';
246
+ import { e2b } from '@computesdk/e2b';
247
+
248
+ export async function POST(request: Request) {
249
+ return handleComputeRequest({
250
+ request,
251
+ provider: e2b({ apiKey: process.env.E2B_API_KEY })
252
+ });
253
+ }
141
254
  ```
142
255
 
143
256
  ## Examples
144
257
 
145
- ### Data Analysis
258
+ ### Data Science Workflow
146
259
 
147
260
  ```typescript
148
- import { e2b } from '@computesdk/e2b';
261
+ const sandbox = await compute.sandbox.create({});
149
262
 
150
- const provider = e2b();
263
+ // Create project structure
264
+ await sandbox.filesystem.mkdir('/analysis');
265
+ await sandbox.filesystem.mkdir('/analysis/data');
266
+ await sandbox.filesystem.mkdir('/analysis/output');
151
267
 
152
- const code = `
153
- import pandas as pd
154
- import numpy as np
268
+ // Write input data
269
+ const csvData = `name,age,city
270
+ Alice,25,New York
271
+ Bob,30,San Francisco
272
+ Charlie,35,Chicago`;
155
273
 
156
- # Create sample data
157
- data = {'A': [1, 2, 3], 'B': [4, 5, 6]}
158
- df = pd.DataFrame(data)
274
+ await sandbox.filesystem.writeFile('/analysis/data/people.csv', csvData);
275
+
276
+ // Process data with Python
277
+ const result = await sandbox.runCode(`
278
+ import pandas as pd
279
+ import matplotlib.pyplot as plt
159
280
 
160
- print("DataFrame:")
281
+ # Read data
282
+ df = pd.read_csv('/analysis/data/people.csv')
283
+ print("Data loaded:")
161
284
  print(df)
162
- print(f"Sum of column A: {df['A'].sum()}")
163
- `;
164
285
 
165
- const result = await provider.doExecute(code);
286
+ # Calculate statistics
287
+ avg_age = df['age'].mean()
288
+ print(f"\\nAverage age: {avg_age}")
289
+
290
+ # Create visualization
291
+ plt.figure(figsize=(8, 6))
292
+ plt.bar(df['name'], df['age'])
293
+ plt.title('Age by Person')
294
+ plt.xlabel('Name')
295
+ plt.ylabel('Age')
296
+ plt.savefig('/analysis/output/age_chart.png')
297
+ print("\\nChart saved to /analysis/output/age_chart.png")
298
+
299
+ # Save results
300
+ results = {
301
+ 'total_people': len(df),
302
+ 'average_age': avg_age,
303
+ 'cities': df['city'].unique().tolist()
304
+ }
305
+
306
+ import json
307
+ with open('/analysis/output/results.json', 'w') as f:
308
+ json.dump(results, f, indent=2)
309
+
310
+ print("Results saved!")
311
+ `);
312
+
166
313
  console.log(result.stdout);
314
+
315
+ // Read the results
316
+ const results = await sandbox.filesystem.readFile('/analysis/output/results.json');
317
+ console.log('Analysis results:', JSON.parse(results));
318
+
319
+ // Check if chart was created
320
+ const chartExists = await sandbox.filesystem.exists('/analysis/output/age_chart.png');
321
+ console.log('Chart created:', chartExists);
167
322
  ```
168
323
 
169
- ### Machine Learning
324
+ ### Interactive Terminal Session
170
325
 
171
326
  ```typescript
172
- import { e2b } from '@computesdk/e2b';
327
+ const sandbox = await compute.sandbox.create({});
328
+
329
+ // Create interactive Python terminal
330
+ const terminal = await sandbox.terminal.create({
331
+ command: 'python3',
332
+ cols: 80,
333
+ rows: 24,
334
+ onData: (data: Uint8Array) => {
335
+ const output = new TextDecoder().decode(data);
336
+ process.stdout.write(output); // Forward to console
337
+ }
338
+ });
173
339
 
174
- const provider = e2b();
340
+ // Send Python commands
341
+ await terminal.write('import numpy as np\n');
342
+ await terminal.write('import pandas as pd\n');
343
+ await terminal.write('print("Libraries loaded!")\n');
344
+ await terminal.write('data = np.array([1, 2, 3, 4, 5])\n');
345
+ await terminal.write('print(f"Mean: {data.mean()}")\n');
346
+ await terminal.write('exit()\n');
175
347
 
176
- const code = `
177
- from sklearn.linear_model import LinearRegression
348
+ // Wait for commands to execute
349
+ await new Promise(resolve => setTimeout(resolve, 2000));
350
+
351
+ await terminal.kill();
352
+ ```
353
+
354
+ ### Machine Learning Pipeline
355
+
356
+ ```typescript
357
+ const sandbox = await compute.sandbox.create({
358
+ options: { timeout: 600000 } // 10 minutes for ML tasks
359
+ });
360
+
361
+ // Create ML project structure
362
+ await sandbox.filesystem.mkdir('/ml-project');
363
+ await sandbox.filesystem.mkdir('/ml-project/data');
364
+ await sandbox.filesystem.mkdir('/ml-project/models');
365
+
366
+ // Generate and process data
367
+ const result = await sandbox.runCode(`
178
368
  import numpy as np
369
+ import pandas as pd
370
+ from sklearn.model_selection import train_test_split
371
+ from sklearn.linear_model import LinearRegression
372
+ from sklearn.metrics import mean_squared_error, r2_score
373
+ import joblib
374
+
375
+ # Generate sample dataset
376
+ np.random.seed(42)
377
+ X = np.random.randn(1000, 5)
378
+ y = X.sum(axis=1) + np.random.randn(1000) * 0.1
379
+
380
+ # Create DataFrame
381
+ feature_names = [f'feature_{i}' for i in range(5)]
382
+ df = pd.DataFrame(X, columns=feature_names)
383
+ df['target'] = y
384
+
385
+ print(f"Dataset shape: {df.shape}")
386
+ print("\\nDataset info:")
387
+ print(df.describe())
179
388
 
180
- # Sample data
181
- X = np.array([[1], [2], [3], [4]])
182
- y = np.array([2, 4, 6, 8])
389
+ # Save dataset
390
+ df.to_csv('/ml-project/data/dataset.csv', index=False)
391
+ print("\\nDataset saved to /ml-project/data/dataset.csv")
392
+
393
+ # Split data
394
+ X_train, X_test, y_train, y_test = train_test_split(
395
+ df[feature_names], df['target'], test_size=0.2, random_state=42
396
+ )
183
397
 
184
398
  # Train model
185
399
  model = LinearRegression()
186
- model.fit(X, y)
400
+ model.fit(X_train, y_train)
187
401
 
188
- # Make prediction
189
- prediction = model.predict([[5]])
190
- print(f"Prediction for x=5: {prediction[0]}")
191
- `;
402
+ # Make predictions
403
+ y_pred = model.predict(X_test)
192
404
 
193
- const result = await provider.doExecute(code);
194
- console.log(result.stdout); // "Prediction for x=5: 10.0"
195
- ```
405
+ # Evaluate
406
+ mse = mean_squared_error(y_test, y_pred)
407
+ r2 = r2_score(y_test, y_pred)
196
408
 
197
- ### File Operations
409
+ print(f"\\nModel Performance:")
410
+ print(f"MSE: {mse:.4f}")
411
+ print(f"R²: {r2:.4f}")
198
412
 
199
- ```typescript
200
- import { e2b } from '@computesdk/e2b';
413
+ # Save model
414
+ joblib.dump(model, '/ml-project/models/linear_model.pkl')
415
+ print("\\nModel saved to /ml-project/models/linear_model.pkl")
201
416
 
202
- const provider = e2b();
417
+ # Save results
418
+ results = {
419
+ 'mse': mse,
420
+ 'r2': r2,
421
+ 'feature_importance': dict(zip(feature_names, model.coef_)),
422
+ 'intercept': model.intercept_
423
+ }
203
424
 
204
- const code = `
205
- # Write to file
206
- with open('data.txt', 'w') as f:
207
- f.write('Hello from E2B sandbox!')
425
+ import json
426
+ with open('/ml-project/results.json', 'w') as f:
427
+ json.dump(results, f, indent=2)
208
428
 
209
- # Read from file
210
- with open('data.txt', 'r') as f:
211
- content = f.read()
212
- print(f"File content: {content}")
213
- `;
429
+ print("Results saved!")
430
+ `);
214
431
 
215
- const result = await provider.doExecute(code);
216
432
  console.log(result.stdout);
217
- ```
218
433
 
219
- ## Limitations
434
+ // Read the results
435
+ const results = await sandbox.filesystem.readFile('/ml-project/results.json');
436
+ console.log('ML Results:', JSON.parse(results));
220
437
 
221
- - **Python Only**: E2B provider currently only supports Python runtime
222
- - **Timeout**: Default 5-minute execution timeout
223
- - **Memory**: Subject to E2B sandbox memory limits
224
- - **Network**: Limited network access in sandboxes
438
+ // Verify model file exists
439
+ const modelExists = await sandbox.filesystem.exists('/ml-project/models/linear_model.pkl');
440
+ console.log('Model saved:', modelExists);
441
+ ```
225
442
 
226
443
  ## Best Practices
227
444
 
228
- 1. **Always handle errors**: Use try-catch blocks for robust error handling
229
- 2. **Set appropriate timeouts**: Adjust timeout based on your use case
230
- 3. **Clean up resources**: Call `doKill()` when done to free resources
231
- 4. **Monitor usage**: Keep track of your E2B API usage and quotas
232
- 5. **Optimize code**: Write efficient Python code to avoid timeout/memory issues
445
+ 1. **Resource Management**: Always destroy sandboxes when done to free resources
446
+ 2. **Error Handling**: Use try-catch blocks for robust error handling
447
+ 3. **Timeouts**: Set appropriate timeouts for long-running tasks
448
+ 4. **File Organization**: Use the filesystem API to organize project files
449
+ 5. **Terminal Sessions**: Clean up terminal sessions with `terminal.kill()`
450
+ 6. **API Key Security**: Never commit API keys to version control
451
+
452
+ ## Limitations
453
+
454
+ - **Sandbox Listing**: E2B doesn't support listing all sandboxes (each is managed individually)
455
+ - **Memory Limits**: Subject to E2B sandbox memory constraints
456
+ - **Network Access**: Limited outbound network access
457
+ - **File Persistence**: Files are not persisted between sandbox sessions
458
+ - **Execution Time**: Subject to E2B timeout limits
233
459
 
234
460
  ## Support
235
461
 
236
- - E2B Documentation: [e2b.dev/docs](https://e2b.dev/docs)
237
- - ComputeSDK Issues: [GitHub Issues](https://github.com/computesdk/computesdk/issues)
238
- - E2B Support: [E2B Support](https://e2b.dev/support)
462
+ - [E2B Documentation](https://e2b.dev/docs)
463
+ - [ComputeSDK Issues](https://github.com/computesdk/computesdk/issues)
464
+ - [E2B Support](https://e2b.dev/support)
239
465
 
240
466
  ## License
241
467
 
package/dist/index.d.mts CHANGED
@@ -1,19 +1,20 @@
1
- import { ComputeSpecification, SandboxConfig, Runtime, ExecutionResult, SandboxInfo } from 'computesdk';
1
+ import * as computesdk from 'computesdk';
2
+ import { Runtime } from 'computesdk';
2
3
 
3
- declare class E2BProvider implements ComputeSpecification {
4
- readonly specificationVersion: "v1";
5
- readonly provider = "e2b";
6
- readonly sandboxId: string;
7
- private session;
8
- private readonly apiKey;
9
- private readonly runtime;
10
- private readonly timeout;
11
- constructor(config: SandboxConfig);
12
- private ensureSession;
13
- doExecute(code: string, runtime?: Runtime): Promise<ExecutionResult>;
14
- doKill(): Promise<void>;
15
- doGetInfo(): Promise<SandboxInfo>;
4
+ /**
5
+ * E2B-specific configuration options
6
+ */
7
+ interface E2BConfig {
8
+ /** E2B API key - if not provided, will fallback to E2B_API_KEY environment variable */
9
+ apiKey?: string;
10
+ /** Default runtime environment */
11
+ runtime?: Runtime;
12
+ /** Execution timeout in milliseconds */
13
+ timeout?: number;
16
14
  }
17
- declare function e2b(config?: Partial<SandboxConfig>): E2BProvider;
15
+ /**
16
+ * Create an E2B provider instance using the factory pattern
17
+ */
18
+ declare const e2b: (config: E2BConfig) => computesdk.Provider;
18
19
 
19
- export { E2BProvider, e2b };
20
+ export { type E2BConfig, e2b };
package/dist/index.d.ts CHANGED
@@ -1,19 +1,20 @@
1
- import { ComputeSpecification, SandboxConfig, Runtime, ExecutionResult, SandboxInfo } from 'computesdk';
1
+ import * as computesdk from 'computesdk';
2
+ import { Runtime } from 'computesdk';
2
3
 
3
- declare class E2BProvider implements ComputeSpecification {
4
- readonly specificationVersion: "v1";
5
- readonly provider = "e2b";
6
- readonly sandboxId: string;
7
- private session;
8
- private readonly apiKey;
9
- private readonly runtime;
10
- private readonly timeout;
11
- constructor(config: SandboxConfig);
12
- private ensureSession;
13
- doExecute(code: string, runtime?: Runtime): Promise<ExecutionResult>;
14
- doKill(): Promise<void>;
15
- doGetInfo(): Promise<SandboxInfo>;
4
+ /**
5
+ * E2B-specific configuration options
6
+ */
7
+ interface E2BConfig {
8
+ /** E2B API key - if not provided, will fallback to E2B_API_KEY environment variable */
9
+ apiKey?: string;
10
+ /** Default runtime environment */
11
+ runtime?: Runtime;
12
+ /** Execution timeout in milliseconds */
13
+ timeout?: number;
16
14
  }
17
- declare function e2b(config?: Partial<SandboxConfig>): E2BProvider;
15
+ /**
16
+ * Create an E2B provider instance using the factory pattern
17
+ */
18
+ declare const e2b: (config: E2BConfig) => computesdk.Provider;
18
19
 
19
- export { E2BProvider, e2b };
20
+ export { type E2BConfig, e2b };