Use the E2B SDK with guplet
Set the standard E2B environment variables in your Python or Node.js application. Use your team’s guplet API key.
export E2B_DOMAIN=guplet.com
export E2B_API_KEY='guplet_…'
The SDK uses api.guplet.com for lifecycle requests and 49983-<sandboxId>.guplet.com for commands and files. Clear any previous E2B_API_URL or E2B_SANDBOX_URL overrides so the SDK uses those hosts.
Python
pip install e2b==2.67.1
from e2b import Sandbox
with Sandbox.create("toolbox") as sandbox:
sandbox.files.write("/tmp/hello.txt", "Hello from guplet")
print(sandbox.commands.run("cat /tmp/hello.txt").stdout)
JavaScript
npm install e2b@2.67.1
import { Sandbox } from 'e2b'
const sandbox = await Sandbox.create('toolbox')
try {
await sandbox.files.write('/tmp/hello.txt', 'Hello from guplet')
console.log((await sandbox.commands.run('cat /tmp/hello.txt')).stdout)
} finally {
await sandbox.kill()
}
Supported operations
- Create, get, list, kill, pause, connect, and set the timeout. Use guplet image names such as
toolboxandubuntu-24.04as template IDs. The SDK’sbasetemplate maps totoolbox, and fresh creates use sizes(2 vCPU, 2 GiB, 20 GiB). Pro teams can use the warm pool fortoolbox. Unknown template IDs return 404. guplet pauses the sandbox when its lease expires. - Create, list, restore, and delete snapshots. Create a new sandbox from a snapshot by passing the returned snapshot ID as the template. The new sandbox keeps the source size.
- Run foreground commands and stream stdout and stderr. Read and write files and list one directory level.
Template builds, custom network policies, PTYs, background process controls, and stdin are outside this compatibility API.