Integrate
Use Twig with E2B
E2B supplies compute. Twig supplies the persistent directory.
// Trusted backend: acquire a scoped writer attachment.
const attachment = await twig.attachments.create(disk.id, {
owner: sandbox.sandboxId, role: 'writer', ttl_seconds: 60,
});
// Follow examples/e2b for secure credential delivery,
// mount setup, lease renewal and runner replacement.
// The runner receives attachment credentials only.Runner prerequisites
Use nfs-common, stunnel4 and the standard mount/losetup tools. The tested E2B kernel provides native NFS, loop devices and ext4. Bake tools into your template, then deliver workspace-specific credentials at launch. ZFS runs on the storage server, not in E2B.
Mounting
The TLS tunnel connects to the scoped export. A loop device with direct I/O mounts the ext4 disk image at /workspace. Verify the mount before launching work; never silently fall back to an empty local directory. See the checked-in mount helper for the supported configuration.
Checkpointing and recovery
Flush saved work before checkpoint capture. Capture preserves the writer and needs no remount; same-disk lease renewal continues during publication. After runner loss, start a new runner and reacquire access from the trusted backend. Paused VM state is not the durability mechanism.