Quickstart

Quickstart

Get up and running with Akira in 5 minutes. This guide walks you through installing the SDK, creating your first sandbox, and executing commands.

Prerequisites

Installation

Install the Akira SDK using your preferred package manager:

npm install @akiralabs/sandbox-sdk

Set Your API Key

Store your API key as an environment variable:

export AKIRA_API_KEY=your_api_key_here

Create Your First Sandbox

import SandboxSDK from '@akiralabs/sandbox-sdk';
 
const client = new SandboxSDK({
  apiKey: process.env['AKIRA_API_KEY'],
});
 
// Create a sandbox with default settings
const sandbox = await client.sandboxes.create({
  image: 'akiralabs/akira-default-sandbox',
});
 
console.log(`Sandbox created: ${sandbox.id}`);

Execute a Command

Once your sandbox is running, execute commands:

const result = await client.sandboxes.execute(sandbox.id, {
  command: 'python3 -c "print(2 + 2)"',
});
 
console.log(result.stdout); // 4
console.log(`Exit code: ${result.exit_code}`);

Upload and Run a Script

Upload a file and execute it:

// Upload a Python script using multipart form-data
const formData = new FormData();
formData.append('file', new Blob(['print("Hello from Akira!")']), 'script.py');
formData.append('path', '/app/script.py');
 
await client.sandboxes.upload(sandbox.id, formData);
 
// Run the script
const result = await client.sandboxes.execute(sandbox.id, {
  command: 'python3 /app/script.py',
});
 
console.log(result.stdout); // Hello from Akira!

Clean Up

Delete your sandbox when done:

await client.sandboxes.delete(sandbox.id);

Next Steps