| name | mosaic-sandbox |
| description | Guide for creating and managing Mosaic sandboxes using ComputeSDK. Use when building applications that need Mosaic provider for ComputeSDK - Firecracker-based sandbox environments. |
Mosaic Sandboxes with ComputeSDK
Mosaic provider for ComputeSDK - Firecracker-based sandbox environments.
Setup
npm install computesdk @computesdk/mosaic
Set your credentials:
MOSAIC_API_TOKEN=your_mosaic_api_token
MOSAIC_API_URL=your_mosaic_api_url
Quick Start
import { compute } from 'computesdk';
import { mosaic } from '@computesdk/mosaic';
compute.setConfig({
provider: mosaic({
apiKey: process.env.MOSAIC_API_TOKEN,
baseUrl: process.env.MOSAIC_API_URL,
}),
});
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand('echo "Hello from Mosaic!"');
console.log(result.stdout);
await sandbox.destroy();
You can also call the provider factory directly:
import { mosaic } from '@computesdk/mosaic';
const sdk = mosaic({
apiKey: process.env.MOSAIC_API_TOKEN,
baseUrl: process.env.MOSAIC_API_URL,
});
const sandbox = await sdk.sandbox.create();
Mosaic Configuration
interface MosaicConfig {
baseUrl?: string;
apiKey?: string;
template?: string;
memoryMb?: number;
vcpu?: number;
requestTimeoutMs?: number;
maxConcurrentRequests?: number;
networkEnabled?: boolean;
previewExpiresInSeconds?: number;
}
Full API
ComputeSDK exposes the same universal sandbox API across providers: sandbox.create(), sandbox.getById(), sandbox.destroy(), sandbox.runCommand(), sandbox.getInfo(), sandbox.getUrl(), and sandbox.filesystem.*.
Install the main skill for the complete reference:
npx skills add https://github.com/computesdk/sandbox-skills --skill computesdk
Or see https://www.computesdk.com/docs/reference/sandbox/.