@lizard-build/sdk 0.1.23 → 0.1.25
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 +9 -7
- package/dist/index.d.mts +17 -11
- package/dist/index.d.ts +17 -11
- package/dist/index.js +11 -6
- package/dist/index.mjs +11 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Firecracker microVM sandboxes for AI agents — boot a full Linux environment in milliseconds, run code, write files, and expose ports, all from your agent or CI pipeline.
|
|
4
4
|
|
|
5
|
-
Each sandbox is an isolated microVM with its own filesystem, network, and process namespace. Sandboxes can be
|
|
5
|
+
Each sandbox is an isolated microVM with its own filesystem, network, and process namespace. Sandboxes can be paused — vCPUs frozen, memory and running processes kept — and resumed instantly, so a long-running agent session picks up without re-running setup.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ import { Lizard } from '@lizard-build/sdk'
|
|
|
26
26
|
// apiKey defaults to the LIZARD_API_KEY env var.
|
|
27
27
|
const lizard = new Lizard({ project: 'my-project' })
|
|
28
28
|
|
|
29
|
-
// Boot a microVM from the 'base' template (Debian + Node.js
|
|
29
|
+
// Boot a microVM from the 'base' template (Debian + Node.js 26)
|
|
30
30
|
const sandbox = await lizard.create('base')
|
|
31
31
|
|
|
32
32
|
// Write a file directly into the microVM filesystem
|
|
@@ -82,7 +82,9 @@ sandbox.kill()
|
|
|
82
82
|
|
|
83
83
|
## Pause and Resume
|
|
84
84
|
|
|
85
|
-
Sandboxes can be
|
|
85
|
+
Sandboxes can be paused mid-execution and resumed exactly where they left off — including installed packages, in-memory state, and running processes. Pausing freezes the microVM's vCPUs; memory and processes stay in the host's RAM and are not written to disk, so a paused sandbox does not survive a host failure. This makes Lizard sandboxes well-suited for long-running AI agent workflows where you want to stop and continue across separate invocations.
|
|
86
|
+
|
|
87
|
+
Pausing does not stop the sandbox timeout — a paused sandbox is still deleted at its original expiry (default 5 minutes). Pass `timeoutMs: 0` (`timeout_ms=0` in Python) at create time to opt out of expiry.
|
|
86
88
|
|
|
87
89
|
```ts
|
|
88
90
|
// Boot and set up the environment once (reusing the `lizard` client from above)
|
|
@@ -91,7 +93,7 @@ await sandbox.process.exec('pip install numpy pandas scikit-learn')
|
|
|
91
93
|
const id = sandbox.sandboxId
|
|
92
94
|
await sandbox.pause()
|
|
93
95
|
|
|
94
|
-
// Later — resume instantly
|
|
96
|
+
// Later — resume instantly (no reinstall needed)
|
|
95
97
|
const resumed = await lizard.connect(id)
|
|
96
98
|
const result = await resumed.process.exec('python -c "import sklearn; print(sklearn.__version__)"')
|
|
97
99
|
console.log(result.stdout)
|
|
@@ -126,7 +128,7 @@ const sandbox = await lizard.create('code-interpreter-v1', { timeoutMs: 10 * 60
|
|
|
126
128
|
|
|
127
129
|
### `Sandbox.create(template?, opts?)`
|
|
128
130
|
|
|
129
|
-
Boot a new Lizard microVM. Built-in templates: `base` (Debian + Node.js
|
|
131
|
+
Boot a new Lizard microVM. Built-in templates: `base` (Debian + Node.js 26) and `code-interpreter-v1` (Python 3.14 + Node.js 26). Custom templates can be pushed via `lizard push`. A project is required — pass `project` (ID, slug, or name) or an exact `projectId` in `opts`, or use a `Lizard` client, which pins one for you.
|
|
130
132
|
|
|
131
133
|
```ts
|
|
132
134
|
const sandbox = await Sandbox.create('base', { project: 'my-project' })
|
|
@@ -135,7 +137,7 @@ const sandbox = await Sandbox.create('code-interpreter-v1', { project: 'my-proje
|
|
|
135
137
|
|
|
136
138
|
### `Sandbox.connect(sandboxId, opts?)`
|
|
137
139
|
|
|
138
|
-
Connect to an existing sandbox by ID. If the sandbox is paused, it is automatically resumed
|
|
140
|
+
Connect to an existing sandbox by ID. If the sandbox is paused, it is automatically resumed.
|
|
139
141
|
|
|
140
142
|
### `Sandbox.list(opts?)`
|
|
141
143
|
|
|
@@ -177,7 +179,7 @@ const url = sandbox.getHost(3000)
|
|
|
177
179
|
|
|
178
180
|
### `sandbox.pause()` / `sandbox.resume()`
|
|
179
181
|
|
|
180
|
-
|
|
182
|
+
Freeze and unfreeze the microVM's vCPUs. Memory and running processes are kept in the host's RAM, not written to disk. The timeout keeps running while paused.
|
|
181
183
|
|
|
182
184
|
### `sandbox.kill()`
|
|
183
185
|
|
package/dist/index.d.mts
CHANGED
|
@@ -177,12 +177,13 @@ declare class SandboxClient {
|
|
|
177
177
|
*
|
|
178
178
|
* Each sandbox is a full Linux environment with its own filesystem, network,
|
|
179
179
|
* and process namespace. Sandboxes are spun up from templates and can be
|
|
180
|
-
* paused
|
|
181
|
-
* agent sessions or ephemeral code
|
|
180
|
+
* paused — vCPUs frozen, memory and running processes kept — then resumed
|
|
181
|
+
* instantly, perfect for stateful AI agent sessions or ephemeral code
|
|
182
|
+
* execution.
|
|
182
183
|
*
|
|
183
184
|
* @example Basic usage:
|
|
184
185
|
* ```ts
|
|
185
|
-
* import { Sandbox } from 'lizard'
|
|
186
|
+
* import { Sandbox } from '@lizard-build/sdk'
|
|
186
187
|
*
|
|
187
188
|
* const sandbox = await Sandbox.create('base', { project: 'my-project' })
|
|
188
189
|
* await sandbox.fs.write('/app/index.js', 'console.log("hello world")')
|
|
@@ -245,8 +246,8 @@ declare class Sandbox extends SandboxClient {
|
|
|
245
246
|
/**
|
|
246
247
|
* Create a new Lizard sandbox from the specified template.
|
|
247
248
|
*
|
|
248
|
-
* Available templates: `base` (Debian + Node.js
|
|
249
|
-
* (Python 3.
|
|
249
|
+
* Available templates: `base` (Debian + Node.js 26) and `code-interpreter-v1`
|
|
250
|
+
* (Python 3.14 + Node.js 26). Custom templates can be built and pushed via
|
|
250
251
|
* `lizard push`.
|
|
251
252
|
*
|
|
252
253
|
* @param template Name of the sandbox template to boot from.
|
|
@@ -262,7 +263,7 @@ declare class Sandbox extends SandboxClient {
|
|
|
262
263
|
* Connect to an existing sandbox by its ID.
|
|
263
264
|
*
|
|
264
265
|
* If the sandbox is currently paused, it will be automatically resumed
|
|
265
|
-
*
|
|
266
|
+
* before this call returns.
|
|
266
267
|
*
|
|
267
268
|
* @example
|
|
268
269
|
* ```ts
|
|
@@ -286,16 +287,21 @@ declare class Sandbox extends SandboxClient {
|
|
|
286
287
|
*/
|
|
287
288
|
kill(opts?: ConnectionOpts): Promise<boolean>;
|
|
288
289
|
/**
|
|
289
|
-
*
|
|
290
|
+
* Pause the sandbox microVM by freezing its vCPUs.
|
|
290
291
|
*
|
|
291
|
-
*
|
|
292
|
-
* to
|
|
292
|
+
* Memory, filesystem, and running processes are held in the host's RAM —
|
|
293
|
+
* nothing is written to disk, so a paused sandbox does not survive a host
|
|
294
|
+
* failure. Resume with `sandbox.resume()` or `Sandbox.connect(id)`.
|
|
295
|
+
*
|
|
296
|
+
* Pausing does not stop the timeout: a paused sandbox is still deleted at
|
|
297
|
+
* its original expiry (default 5 minutes). Pass `timeoutMs: 0` at create
|
|
298
|
+
* time to opt out of expiry.
|
|
293
299
|
*
|
|
294
300
|
* @returns `true` if paused successfully.
|
|
295
301
|
*/
|
|
296
302
|
pause(opts?: ConnectionOpts): Promise<boolean>;
|
|
297
303
|
/**
|
|
298
|
-
* Resume a paused sandbox
|
|
304
|
+
* Resume a paused sandbox by unfreezing its vCPUs.
|
|
299
305
|
*
|
|
300
306
|
* @returns `true` if resumed successfully.
|
|
301
307
|
*/
|
|
@@ -494,7 +500,7 @@ declare class ServicesAPI {
|
|
|
494
500
|
limit?: number;
|
|
495
501
|
since?: string;
|
|
496
502
|
}): Promise<LogLine[]>;
|
|
497
|
-
/** Execute a command inside the running service
|
|
503
|
+
/** Execute a command inside the running service container. */
|
|
498
504
|
exec(id: string, cmd: string, opts?: {
|
|
499
505
|
timeoutMs?: number;
|
|
500
506
|
}): Promise<{
|
package/dist/index.d.ts
CHANGED
|
@@ -177,12 +177,13 @@ declare class SandboxClient {
|
|
|
177
177
|
*
|
|
178
178
|
* Each sandbox is a full Linux environment with its own filesystem, network,
|
|
179
179
|
* and process namespace. Sandboxes are spun up from templates and can be
|
|
180
|
-
* paused
|
|
181
|
-
* agent sessions or ephemeral code
|
|
180
|
+
* paused — vCPUs frozen, memory and running processes kept — then resumed
|
|
181
|
+
* instantly, perfect for stateful AI agent sessions or ephemeral code
|
|
182
|
+
* execution.
|
|
182
183
|
*
|
|
183
184
|
* @example Basic usage:
|
|
184
185
|
* ```ts
|
|
185
|
-
* import { Sandbox } from 'lizard'
|
|
186
|
+
* import { Sandbox } from '@lizard-build/sdk'
|
|
186
187
|
*
|
|
187
188
|
* const sandbox = await Sandbox.create('base', { project: 'my-project' })
|
|
188
189
|
* await sandbox.fs.write('/app/index.js', 'console.log("hello world")')
|
|
@@ -245,8 +246,8 @@ declare class Sandbox extends SandboxClient {
|
|
|
245
246
|
/**
|
|
246
247
|
* Create a new Lizard sandbox from the specified template.
|
|
247
248
|
*
|
|
248
|
-
* Available templates: `base` (Debian + Node.js
|
|
249
|
-
* (Python 3.
|
|
249
|
+
* Available templates: `base` (Debian + Node.js 26) and `code-interpreter-v1`
|
|
250
|
+
* (Python 3.14 + Node.js 26). Custom templates can be built and pushed via
|
|
250
251
|
* `lizard push`.
|
|
251
252
|
*
|
|
252
253
|
* @param template Name of the sandbox template to boot from.
|
|
@@ -262,7 +263,7 @@ declare class Sandbox extends SandboxClient {
|
|
|
262
263
|
* Connect to an existing sandbox by its ID.
|
|
263
264
|
*
|
|
264
265
|
* If the sandbox is currently paused, it will be automatically resumed
|
|
265
|
-
*
|
|
266
|
+
* before this call returns.
|
|
266
267
|
*
|
|
267
268
|
* @example
|
|
268
269
|
* ```ts
|
|
@@ -286,16 +287,21 @@ declare class Sandbox extends SandboxClient {
|
|
|
286
287
|
*/
|
|
287
288
|
kill(opts?: ConnectionOpts): Promise<boolean>;
|
|
288
289
|
/**
|
|
289
|
-
*
|
|
290
|
+
* Pause the sandbox microVM by freezing its vCPUs.
|
|
290
291
|
*
|
|
291
|
-
*
|
|
292
|
-
* to
|
|
292
|
+
* Memory, filesystem, and running processes are held in the host's RAM —
|
|
293
|
+
* nothing is written to disk, so a paused sandbox does not survive a host
|
|
294
|
+
* failure. Resume with `sandbox.resume()` or `Sandbox.connect(id)`.
|
|
295
|
+
*
|
|
296
|
+
* Pausing does not stop the timeout: a paused sandbox is still deleted at
|
|
297
|
+
* its original expiry (default 5 minutes). Pass `timeoutMs: 0` at create
|
|
298
|
+
* time to opt out of expiry.
|
|
293
299
|
*
|
|
294
300
|
* @returns `true` if paused successfully.
|
|
295
301
|
*/
|
|
296
302
|
pause(opts?: ConnectionOpts): Promise<boolean>;
|
|
297
303
|
/**
|
|
298
|
-
* Resume a paused sandbox
|
|
304
|
+
* Resume a paused sandbox by unfreezing its vCPUs.
|
|
299
305
|
*
|
|
300
306
|
* @returns `true` if resumed successfully.
|
|
301
307
|
*/
|
|
@@ -494,7 +500,7 @@ declare class ServicesAPI {
|
|
|
494
500
|
limit?: number;
|
|
495
501
|
since?: string;
|
|
496
502
|
}): Promise<LogLine[]>;
|
|
497
|
-
/** Execute a command inside the running service
|
|
503
|
+
/** Execute a command inside the running service container. */
|
|
498
504
|
exec(id: string, cmd: string, opts?: {
|
|
499
505
|
timeoutMs?: number;
|
|
500
506
|
}): Promise<{
|
package/dist/index.js
CHANGED
|
@@ -370,7 +370,7 @@ var Sandbox = class extends SandboxClient {
|
|
|
370
370
|
* Connect to an existing sandbox by its ID.
|
|
371
371
|
*
|
|
372
372
|
* If the sandbox is currently paused, it will be automatically resumed
|
|
373
|
-
*
|
|
373
|
+
* before this call returns.
|
|
374
374
|
*
|
|
375
375
|
* @example
|
|
376
376
|
* ```ts
|
|
@@ -401,10 +401,15 @@ var Sandbox = class extends SandboxClient {
|
|
|
401
401
|
return SandboxClient.killSandbox(this.sandboxId, this.resolveOpts(opts));
|
|
402
402
|
}
|
|
403
403
|
/**
|
|
404
|
-
*
|
|
404
|
+
* Pause the sandbox microVM by freezing its vCPUs.
|
|
405
405
|
*
|
|
406
|
-
*
|
|
407
|
-
* to
|
|
406
|
+
* Memory, filesystem, and running processes are held in the host's RAM —
|
|
407
|
+
* nothing is written to disk, so a paused sandbox does not survive a host
|
|
408
|
+
* failure. Resume with `sandbox.resume()` or `Sandbox.connect(id)`.
|
|
409
|
+
*
|
|
410
|
+
* Pausing does not stop the timeout: a paused sandbox is still deleted at
|
|
411
|
+
* its original expiry (default 5 minutes). Pass `timeoutMs: 0` at create
|
|
412
|
+
* time to opt out of expiry.
|
|
408
413
|
*
|
|
409
414
|
* @returns `true` if paused successfully.
|
|
410
415
|
*/
|
|
@@ -412,7 +417,7 @@ var Sandbox = class extends SandboxClient {
|
|
|
412
417
|
return SandboxClient.pauseSandbox(this.sandboxId, this.resolveOpts(opts));
|
|
413
418
|
}
|
|
414
419
|
/**
|
|
415
|
-
* Resume a paused sandbox
|
|
420
|
+
* Resume a paused sandbox by unfreezing its vCPUs.
|
|
416
421
|
*
|
|
417
422
|
* @returns `true` if resumed successfully.
|
|
418
423
|
*/
|
|
@@ -674,7 +679,7 @@ var ServicesAPI = class {
|
|
|
674
679
|
const result = await this.client.get(`/api/apps/${id}/logs?${qs}`);
|
|
675
680
|
return Array.isArray(result) ? result : result.logs ?? [];
|
|
676
681
|
}
|
|
677
|
-
/** Execute a command inside the running service
|
|
682
|
+
/** Execute a command inside the running service container. */
|
|
678
683
|
exec(id, cmd, opts) {
|
|
679
684
|
return this.client.post(`/api/apps/${id}/exec`, { cmd, timeoutMs: opts?.timeoutMs });
|
|
680
685
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -335,7 +335,7 @@ var Sandbox = class extends SandboxClient {
|
|
|
335
335
|
* Connect to an existing sandbox by its ID.
|
|
336
336
|
*
|
|
337
337
|
* If the sandbox is currently paused, it will be automatically resumed
|
|
338
|
-
*
|
|
338
|
+
* before this call returns.
|
|
339
339
|
*
|
|
340
340
|
* @example
|
|
341
341
|
* ```ts
|
|
@@ -366,10 +366,15 @@ var Sandbox = class extends SandboxClient {
|
|
|
366
366
|
return SandboxClient.killSandbox(this.sandboxId, this.resolveOpts(opts));
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
369
|
-
*
|
|
369
|
+
* Pause the sandbox microVM by freezing its vCPUs.
|
|
370
370
|
*
|
|
371
|
-
*
|
|
372
|
-
* to
|
|
371
|
+
* Memory, filesystem, and running processes are held in the host's RAM —
|
|
372
|
+
* nothing is written to disk, so a paused sandbox does not survive a host
|
|
373
|
+
* failure. Resume with `sandbox.resume()` or `Sandbox.connect(id)`.
|
|
374
|
+
*
|
|
375
|
+
* Pausing does not stop the timeout: a paused sandbox is still deleted at
|
|
376
|
+
* its original expiry (default 5 minutes). Pass `timeoutMs: 0` at create
|
|
377
|
+
* time to opt out of expiry.
|
|
373
378
|
*
|
|
374
379
|
* @returns `true` if paused successfully.
|
|
375
380
|
*/
|
|
@@ -377,7 +382,7 @@ var Sandbox = class extends SandboxClient {
|
|
|
377
382
|
return SandboxClient.pauseSandbox(this.sandboxId, this.resolveOpts(opts));
|
|
378
383
|
}
|
|
379
384
|
/**
|
|
380
|
-
* Resume a paused sandbox
|
|
385
|
+
* Resume a paused sandbox by unfreezing its vCPUs.
|
|
381
386
|
*
|
|
382
387
|
* @returns `true` if resumed successfully.
|
|
383
388
|
*/
|
|
@@ -639,7 +644,7 @@ var ServicesAPI = class {
|
|
|
639
644
|
const result = await this.client.get(`/api/apps/${id}/logs?${qs}`);
|
|
640
645
|
return Array.isArray(result) ? result : result.logs ?? [];
|
|
641
646
|
}
|
|
642
|
-
/** Execute a command inside the running service
|
|
647
|
+
/** Execute a command inside the running service container. */
|
|
643
648
|
exec(id, cmd, opts) {
|
|
644
649
|
return this.client.post(`/api/apps/${id}/exec`, { cmd, timeoutMs: opts?.timeoutMs });
|
|
645
650
|
}
|