Start here
Your first workspace
Connect to a configured Twig service, create a disk, then attach your runner.
import { Twig } from '@twigdev/sdk';
const twig = new Twig({
baseUrl: process.env.TWIG_API_URL!,
apiKey: process.env.TWIG_API_KEY!,
organizationId: process.env.TWIG_ORG_ID!,
});
const disk = await twig.disks.create({
name: 'my-workspace', region: 'us-west1', size_gib: 8,
});
const attachment = await twig.attachments.create(disk.id, {
owner: 'runner-123', role: 'writer', ttl_seconds: 60,
});Before you begin
Create an organization and an API key in the dashboard. Copy the organization ID from the API keys page into TWIG_ORG_ID; authenticated GET /api/v1/auth/session also lists organization IDs. The deployment must have a real storage worker and checkpoint bucket configured. Keep API keys in your trusted backend, not student code. The TypeScript SDK currently ships from this repository; a registry package release is pending.
Attach and renew
Pass only the scoped attachment connection material to the runner. Use the E2B example’s mount helper. Renew the attachment from your trusted service before its lease expires; expiry fences storage access independently of the guest.
Next
Run the E2B example in examples/e2b. Review its live checkpoint lifecycle before connecting a live application. SDK method names and installation steps are documented in the repository README.