Skip to content

Latest commit

 

History

History
82 lines (67 loc) · 1.58 KB

File metadata and controls

82 lines (67 loc) · 1.58 KB
description Use Beam with ComputeSDK to create sandboxes with token and workspace authentication, then run commands with configurable gateway and timeout settings.
layout
width title description tableOfContents outline pagination metadata tags actions
default
visible
true
visible
visible
true
visible
true
visible
true
visible
true
visible
true
visible
true
tags
tag primary
benchmarked
true

Beam

{% embed url="https://www.computesdk.com/benchmarks/sandboxes/beam/" %}

Beam provider for ComputeSDK

Installation & Setup

npm install @computesdk/beam

Add your Beam credentials to a .env file:

BEAM_TOKEN=your_beam_token
BEAM_WORKSPACE_ID=your_beam_workspace_id

Usage

import { beam } from '@computesdk/beam';

const compute = beam({
  token: process.env.BEAM_TOKEN,
  workspaceId: process.env.BEAM_WORKSPACE_ID,
});

// Create sandbox
const sandbox = await compute.sandbox.create();

// Run a command
const result = await sandbox.runCommand('echo "Hello from Beam!"');
console.log(result.stdout); // "Hello from Beam!"

// Clean up
await sandbox.destroy();

Configuration Options

interface BeamConfig {
  /** Beam API token - if not provided, will use BEAM_TOKEN env var */
  token?: string;
  /** Beam workspace ID - if not provided, will use BEAM_WORKSPACE_ID env var */
  workspaceId?: string;
  /** Gateway URL for custom/staging environments */
  gatewayUrl?: string;
  /** Request timeout in milliseconds */
  timeout?: number;
}