> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beam.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK Reference

Beam's TypeScript SDK provides a powerful client library for interacting with the Beam platform. Unlike decorators and frameworks in the Python SDK, the TypeScript SDK focuses on programmatic access to Beam's infrastructure and resources.

This reference outlines every available class, method, and configuration option in the TypeScript SDK.

# Installation

Install the package with `npm`:

```typescript theme={null}
npm install @beamcloud/beam-js@rc
```

...or using `yarn`:

```typescript theme={null}
yarn add @beamcloud/beam-js@rc
```

# Configuration

Locate your Beam Token (API Key) and Workspace ID in the [dashboard](https://platform.beam.cloud/settings/api-keys) and set them as environment variables.

```bash theme={null}
export BEAM_TOKEN=YOUR_BEAM_TOKEN
export BEAM_WORKSPACE_ID=YOUR_WORKSPACE_ID
```

## `beamOpts`

Global configuration object for the Beam client.

```typescript theme={null}
import { beamOpts } from "@beamcloud/beam-js";

beamOpts.token = process.env.BEAM_TOKEN!;
beamOpts.workspaceId = process.env.BEAM_WORKSPACE_ID!;
beamOpts.gatewayUrl = "https://app.beam.cloud"; // Optional, defaults to https://app.beam.cloud
```

**Required Configuration:**

* `token`: Your Beam authentication token
* `workspaceId`: Your Beam workspace ID

**Optional Configuration:**

* `gatewayUrl`: The Beam gateway URL (defaults to `https://app.beam.cloud`)

## Quickstart

Run a simple Node.js server in a sandbox. This example uses the `Image` class to create a custom container image and the `Sandbox` class to create a sandbox instance.

```typescript theme={null}
import { beamOpts, Image, Sandbox } from "@beamcloud/beam-js";

beamOpts.token = process.env.BEAM_TOKEN!;
beamOpts.workspaceId = process.env.BEAM_WORKSPACE_ID!;

async function main() {
  const image = new Image({
    baseImage: "node:20",
    commands: [
      "apt update",
      "apt install -y nodejs npm",
      "git clone https://github.com/beam-cloud/quickstart-node.git /app",
    ],
  });

  const sandbox = new Sandbox({
    name: "quickstart",
    image: image,
    cpu: 2,
    memory: 1024,
    keepWarmSeconds: 300,
  });

  const instance = await sandbox.create();

  const process4 = await instance.exec([
    "sh",
    "-c",
    "cd /app && node server.js",
  ]);

  const url = await instance.exposePort(3000);
  console.log(`Server is running at ${url}`);
}

main();
```

# Environment

## `Image`

Defines a custom container image that your code will run in.

An Image object encapsulates the configuration of a custom container image that will be used as the runtime environment for executing tasks.

```typescript theme={null}
import {
  Image,
  PythonVersion,
  PythonVersionAlias,
  GpuType,
  GpuTypeAlias,
} from "@beamcloud/beam-js";

const image = new Image({
  baseImage: "docker.io/nvidia/cuda:12.3.1-runtime-ubuntu20.04",
  pythonVersion: PythonVersion.Python311, // Type-safe enum approach
  commands: ["apt-get update -y", "apt-get install ffmpeg -y"],
  pythonPackages: ["transformers", "torch"],
  gpu: GpuType.A10G, // Type-safe enum approach
});

await image.build();

// Alternative using string literals for convenience
const imageWithStringLiterals = new Image({
  baseImage: "docker.io/nvidia/cuda:12.3.1-runtime-ubuntu20.04",
  pythonVersion: "python3.11", // String literal for Python version
  commands: ["apt-get update -y", "apt-get install ffmpeg -y"],
  pythonPackages: ["transformers", "torch"],
  gpu: "A10G", // String literal for GPU
});

await imageWithStringLiterals.build();
```

**Constructor Parameters:**

<ParamField body="pythonVersion" type="PythonVersionAlias" default="PythonVersion.Python3">
  The Python version to be used in the image. Can be a PythonVersion enum (e.g.,
  PythonVersion.Python311) or string literal (e.g., "python3.11"). Defaults to
  Python 3.
</ParamField>

<ParamField body="pythonPackages" type="string[] | string" default="[]">
  A list of Python packages to install in the container image. Alternatively, a
  string containing a path to a requirements.txt can be provided.
</ParamField>

<ParamField body="commands" type="string[]" default="[]">
  A list of shell commands to run when building your container image. These
  commands can be used for setting up the environment, installing dependencies,
  etc.
</ParamField>

<ParamField body="baseImage" type="string" default="">
  A custom base image to replace the default ubuntu20.04 image used in your
  container. This can be a public or private image from Docker Hub, Amazon ECR,
  Google Cloud Artifact Registry, or NVIDIA GPU Cloud Registry.
</ParamField>

<ParamField body="baseImageCreds" type="ImageCredentials" default="{}">
  Credentials for accessing private registries. Can be a dictionary of key/value
  pairs or an array of environment variable names.
</ParamField>

<ParamField body="envVars" type="string[]" default="[]">
  Environment variables to add to the image. These will be available when
  building the image and when the container is running.
</ParamField>

<ParamField body="secrets" type="string[]" default="[]">
  A list of secrets that are injected into the container as environment
  variables.
</ParamField>

<ParamField body="gpu" type="GpuTypeAlias" default="">
  Builds the image on a GPU node. Can be a GpuType enum (e.g., GpuType.H100) or
  string literal (e.g., "H100").
</ParamField>

### `Image.fromDockerfile()`

Create an Image from a local Dockerfile.

```typescript theme={null}
import { Image } from "@beamcloud/beam-js";

const image = await Image.fromDockerfile("./Dockerfile", "./context");
```

<ParamField body="dockerfilePath" type="string" required>
  Path to the Dockerfile.
</ParamField>

<ParamField body="contextDir" type="string" default="undefined">
  Directory to sync as build context. Defaults to the Dockerfile directory.
</ParamField>

### `Image.addPythonPackages()`

Add pip packages to install during the build. Accepts a list or a path to requirements.txt.

```typescript theme={null}
// Using an array of package names
image.addPythonPackages(["transformers==4.44.0", "torch==2.4.0"]);

// Using a requirements.txt file
image.addPythonPackages("./requirements.txt");
```

<ParamField body="packages" type="string[] | string" required>
  Package names or a `requirements.txt` path.
</ParamField>

### `Image.withEnvs()`

Add environment variables available during build and at runtime.

```typescript theme={null}
image.withEnvs({ HF_HOME: "/models", HF_HUB_ENABLE_HF_TRANSFER: "1" });
```

<ParamField body="envVars" type="string[] | Record<string, string> | string" required>
  Environment variables as key/value pairs, array of "KEY=VALUE" strings, or
  single string.
</ParamField>

### `Image.withSecrets()`

Expose platform secrets to the build environment.

```typescript theme={null}
image.withSecrets(["HF_TOKEN"]);
```

<ParamField body="secrets" type="string[]" required>
  Secret names created via the platform.
</ParamField>

### `Image.micromamba()`

Switch package management to micromamba and target a micromamba Python.

```typescript theme={null}
image.micromamba();
```

### `Image.addMicromambaPackages()`

Install micromamba packages and optional channels.

```typescript theme={null}
image.addMicromambaPackages(["pandas", "numpy"], ["conda-forge"]);
```

<ParamField body="packages" type="string[] | string" required>
  Package names or a `requirements.txt` path.
</ParamField>

<ParamField body="channels" type="string[]" default="[]">
  Micromamba channels.
</ParamField>

### `Image.build()`

Build the image and return the result.

```typescript theme={null}
const result = await image.build();
console.log("Build successful:", result.success);
```

# Deployments

## `Deployments`

You can use this to manage and interact with deployed Beam applications.

```typescript theme={null}
import { Deployments } from "@beamcloud/beam-js";

// List all deployments
const deployments = await Deployments.list();

// Get a deployment by ID
const deployment = await Deployments.get({ id: "deployment-id" });

// Get a deployment by name and stub type
const deployment = await Deployments.get({
  name: "my-app",
  stubType: "endpoint/deployment",
});

// Call the deployment
const response = await deployment.call({ message: "Hello World" });

// Connect to realtime deployment
const ws = await deployment.realtime("/", (event) => {
  console.log("Received:", event.data);
});
```

### `Deployments.list()`

List all deployments in your workspace.

```typescript theme={null}
const deployments = await Deployments.list({
  stubType: "endpoint/deployment",
  active: true,
  limit: 10,
});
```

### `Deployments.get()`

Retrieve a deployment by ID, name, or URL.

```typescript theme={null}
// By ID
const deployment = await Deployments.get({ id: "deployment-id" });

// By name and stub type
const deployment = await Deployments.get({
  name: "my-app",
  stubType: "endpoint/deployment",
});
```

<ParamField body="id" type="string">
  The deployment ID to retrieve.
</ParamField>

<ParamField body="name" type="string">
  The deployment name (must be used with stubType).
</ParamField>

<ParamField body="stubType" type="string">
  The stub type (must be used with name).
</ParamField>

<ParamField body="url" type="string">
  The deployment URL.
</ParamField>

## `Deployment`

A deployment instance with methods for interaction.

### `Deployment.call()`

Call the deployment with data.

```typescript theme={null}
const response = await deployment.call(
  { message: "Hello World" },
  "/endpoint-path", // optional path
  "POST", // optional HTTP method
);
```

<ParamField body="data" type="any" required>
  The data to send to the deployment.
</ParamField>

<ParamField body="path" type="string" default="">
  Optional path to append to the deployment URL.
</ParamField>

<ParamField body="method" type="'GET' | 'POST'" default="'POST'">
  HTTP method to use for the request.
</ParamField>

### `Deployment.realtime()`

Connect to a realtime deployment via WebSocket.

```typescript theme={null}
const ws = await deployment.realtime("/", (event) => {
  console.log("Message received:", event.data);
});

// Send a message
ws.send(JSON.stringify({ message: "Hello" }));
```

<ParamField body="path" type="string" default="">
  Optional path to append to the WebSocket URL.
</ParamField>

<ParamField body="onmessage" type="(event: MessageEvent) => void">
  Optional message handler function.
</ParamField>

### `Deployment.httpUrl()` / `Deployment.websocketUrl()`

Get the HTTP or WebSocket URL for the deployment.

```typescript theme={null}
const httpUrl = deployment.httpUrl("/api/predict");
const wsUrl = deployment.websocketUrl("/realtime");
```

# Sandbox

A sandboxed container for running Python code or arbitrary processes.

You can use this to create isolated environments where you can execute code,
manage files, and run processes.

```typescript theme={null}
import { Sandbox, Image, GpuType } from "@beamcloud/beam-js";

const sandbox = new Sandbox({
  name: "my-sandbox",
  cpu: 2,
  memory: "1Gi",
  gpu: GpuType.T4, // Using enum
  image: new Image({
    pythonPackages: ["numpy", "pandas"],
  }),
  keepWarmSeconds: 300,
});

// Alternative with string literal
const sandboxWithStringGpu = new Sandbox({
  name: "my-sandbox-2",
  cpu: 2,
  memory: "1Gi",
  gpu: "T4", // Using string literal
  image: new Image({
    pythonPackages: ["numpy", "pandas"],
  }),
  keepWarmSeconds: 300,
});

// Create a new sandbox instance
const instance = await sandbox.create();

// Or connect to an existing one
const existingInstance = await Sandbox.connect("sandbox-id");
```

You can also configure sandbox networking at creation time to pre-expose ports
or restrict outbound traffic.

```typescript theme={null}
const networkedSandbox = new Sandbox({
  name: "networked-sandbox",
  image: new Image({
    baseImage: "node:20",
  }),
  ports: [3000, 8080],
  allowList: ["8.8.8.8/32"],
});

const networkedInstance = await networkedSandbox.create();
const urls = await networkedInstance.listUrls();
console.log("Known URLs:", urls);
```

<ParamField body="ports" type="number[]" default="[]">
  Ports to expose immediately when the sandbox is created. These ports will be
  available via public URLs as soon as the sandbox starts.
</ParamField>

<ParamField body="blockNetwork" type="boolean" default="false">
  Blocks all outbound network access from the sandbox while still allowing
  inbound traffic to exposed ports. Cannot be used together with `allowList`.
</ParamField>

<ParamField body="allowList" type="string[]" default="undefined">
  CIDR ranges that the sandbox is allowed to connect to. When specified, all
  other outbound traffic is blocked. Cannot be used together with
  `blockNetwork`.
</ParamField>

### `Sandbox.create()`

Create a new sandbox instance.

```typescript theme={null}
const instance = await sandbox.create(["python", "app.py"]); // optional entrypoint
console.log(`Sandbox created with ID: ${instance.sandboxId}`);
```

### `Sandbox.connect()`

Connect to an existing sandbox instance by ID.

```typescript theme={null}
const instance = await Sandbox.connect("sandbox-123");
```

<ParamField body="id" type="string" required>
  The container ID of the existing sandbox instance.
</ParamField>

### `Sandbox.createFromSnapshot()`

Create a sandbox instance from a filesystem snapshot.

```typescript theme={null}
const instance = await Sandbox.createFromSnapshot("snapshot-123");
```

<ParamField body="snapshotId" type="string" required>
  The ID of the snapshot to create the sandbox from.
</ParamField>

## SandboxInstance

A sandbox instance that provides access to the sandbox internals.

### `SandboxInstance.runCode()`

Run Python code in the sandbox.

```typescript theme={null}
const result = await instance.runCode(`
import numpy as np
print("NumPy version:", np.__version__)
result = np.array([1, 2, 3, 4, 5])
print("Array:", result)
`);

console.log("Output:", result.result);
```

<ParamField body="code" type="string" required>
  The Python code to execute.
</ParamField>

<ParamField body="blocking" type="boolean" default="true">
  Whether to wait for the process to complete.
</ParamField>

### `SandboxInstance.exec()`

Run an arbitrary command in the sandbox.

```typescript theme={null}
// Using an array of command and arguments
const process = await instance.exec(["ls", "-la", "/workspace"]);
const exitCode = await process.wait();

// Using a single string command
const process2 = await instance.exec("ls -la /workspace");

// With execution options
const process3 = await instance.exec(["node", "server.js"], {
  cwd: "/app",
  env: { NODE_ENV: "production" },
});

// Get the process ID
const pid = process.pid;

// Read output
const stdout = await process.stdout.read();
const stderr = await process.stderr.read();
```

<ParamField body="command" type="string | string[]" required>
  The command to execute. Can be a single string or an array of strings (command
  and arguments).
</ParamField>

<ParamField body="opts" type="ExecOptions">
  Optional execution options.
</ParamField>

<ParamField body="opts.cwd" type="string">
  The working directory for the command.
</ParamField>

<ParamField body="opts.env" type="Record<string, string>">
  Environment variables to set for the command.
</ParamField>

### `SandboxInstance.exposePort()`

Dynamically expose a port to the internet.

```typescript theme={null}
const url = await instance.exposePort(8000);
console.log(`Web service available at: ${url}`);
```

<ParamField body="port" type="number" required>
  The port number to expose within the sandbox.
</ParamField>

Use `listUrls()` to inspect every currently exposed URL, including ports
exposed at creation time with `ports`.

### `SandboxInstance.listUrls()`

List the currently exposed preview/public URLs for the sandbox. Returns
`Promise<Record<number, string>>`, keyed by port number.

```typescript theme={null}
const urls = await instance.listUrls();

for (const [port, url] of Object.entries(urls)) {
  console.log(`Port ${port} available at: ${url}`);
}
```

### `SandboxInstance.updateNetworkPermissions()`

Dynamically update outbound network permissions for the sandbox. This method
returns `Promise<void>`.

Because the method signature is positional, pass `false` as the first argument
when updating to an allow list without fully blocking outbound traffic.

```typescript theme={null}
// Block all outbound traffic
await instance.updateNetworkPermissions(true);

// Allow only specific CIDR ranges
await instance.updateNetworkPermissions(false, ["8.8.8.8/32", "10.0.0.0/8"]);

// Remove all outbound restrictions
await instance.updateNetworkPermissions(false, []);
```

<ParamField body="blockNetwork" type="boolean" default="false">
  If `true`, blocks all outbound network access from the sandbox. Cannot be used
  together with `allowList`.
</ParamField>

<ParamField body="allowList" type="string[]">
  Optional list of allowed CIDR ranges. Passing `[]` removes outbound
  restrictions. Cannot be used together with `blockNetwork=true`.
</ParamField>

`allowList` entries must use CIDR notation such as `"8.8.8.8/32"` or
`"10.0.0.0/8"`. `blockNetwork=true` and `allowList` are mutually exclusive, and
exposed ports remain reachable regardless of outbound restrictions.

### `SandboxInstance.snapshot()`

Create a memory snapshot of the current sandbox. This method captures the memory state of the sandbox as an immutable artifact. You can later restore this snapshot into a new sandbox instance using `createFromSnapshot()`.

```typescript theme={null}
const snapshotId = await instance.snapshot();
console.log(`Created memory snapshot: ${snapshotId}`);

// Restore from memory snapshot
const restoredInstance = await Sandbox.createFromSnapshot(snapshotId);
```

### `SandboxInstance.createImageFromFilesystem()`

Create an image from the sandbox filesystem. This method returns an image ID that can be used to create new sandboxes with the same filesystem state. You can use the `Image.fromId()` method to create a new image instance.

```typescript theme={null}
const imageId = await instance.createImageFromFilesystem();
console.log(`Created image from filesystem: ${imageId}`);

// Use the snapshot as a base image for new sandboxes
const image = Image.fromId(imageId);
const newSandbox = new Sandbox({
  name: "from-filesystem",
  image: image,
  // ... other config
});
```

### `SandboxInstance.updateTtl()`

Update the keep warm setting of the sandbox.

```typescript theme={null}
// Keep alive for 1 hour
await instance.updateTtl(3600);

// Make it never timeout
await instance.updateTtl(-1);
```

<ParamField body="ttl" type="number" required>
  The number of seconds to keep the sandbox alive. Use -1 for sandboxes that
  never timeout.
</ParamField>

### `SandboxInstance.sandboxId()`

Get the ID of the sandbox.

```typescript theme={null}
const sandboxId = instance.sandboxId();
```

### `SandboxInstance.terminate()`

Terminate the container associated with this sandbox instance.

```typescript theme={null}
const success = await instance.terminate();
```

## SandboxProcess

Represents a running process within a sandbox.

### `SandboxProcess.wait()`

Wait for the process to complete.

```typescript theme={null}
const process = await instance.exec(["sleep", "5"]);
const exitCode = await process.wait();
console.log("Process exited with code:", exitCode);
```

### `SandboxProcess.kill()`

Kill the process.

```typescript theme={null}
const process = await instance.exec(["sleep", "100"]);
await process.kill();
```

### `SandboxProcess.status()`

Get the status of the process.

```typescript theme={null}
const [exitCode, status] = await process.status();
if (exitCode >= 0) {
  console.log("Process finished with exit code:", exitCode);
}
```

### `SandboxProcess.stdout` / `SandboxProcess.stderr`

Get handles to the process output streams.

```typescript theme={null}
const process = await instance.exec(["echo", "Hello World"]);
const output = await process.stdout.read();
console.log("Output:", output);
```

## SandboxFileSystem

File system interface for managing files within a sandbox.

### `SandboxFileSystem.uploadFile()`

Upload a local file to the sandbox.

```typescript theme={null}
await instance.fs.uploadFile("./local-file.txt", "workspace/uploaded-file.txt");
```

<ParamField body="localPath" type="string" required>
  The path to the local file to upload.
</ParamField>

<ParamField body="sandboxPath" type="string" required>
  The destination path within the sandbox.
</ParamField>

### `SandboxFileSystem.downloadFile()`

Download a file from the sandbox to a local path.

```typescript theme={null}
await instance.fs.downloadFile(
  "workspace/output.txt",
  "./downloaded-output.txt",
);
```

<ParamField body="sandboxPath" type="string" required>
  The path to the file within the sandbox.
</ParamField>

<ParamField body="localPath" type="string" required>
  The destination path on the local filesystem.
</ParamField>

### `SandboxFileSystem.listFiles()`

List the files in a directory in the sandbox.

```typescript theme={null}
const files = await instance.fs.listFiles("/workspace");
for (const file of files) {
  console.log(`${file.name} (${file.isDir ? "directory" : "file"})`);
}
```

<ParamField body="sandboxPath" type="string" required>
  The path to the directory within the sandbox.
</ParamField>

### `SandboxFileSystem.deleteFile()`

Delete a file in the sandbox.

```typescript theme={null}
await instance.fs.deleteFile("/tmp/temp-file.txt");
```

<ParamField body="sandboxPath" type="string" required>
  The path to the file within the sandbox.
</ParamField>

### `SandboxFileSystem.statFile()`

Get metadata of a file in the sandbox.

```typescript theme={null}
const fileInfo = await instance.fs.statFile("/path/to/file.txt");
console.log(`File size: ${fileInfo.size} bytes`);
console.log(`Is directory: ${fileInfo.isDir}`);
```

<ParamField body="sandboxPath" type="string" required>
  The path to the file within the sandbox.
</ParamField>

# Pod

A **Pod** is an object that allows you to run arbitrary services in a fast, scalable, and secure remote container on Beam.

You can think of a Pod as a lightweight compute environment that you fully control—complete with a custom container, ports you can expose, environment variables, volumes, secrets, and GPUs.

```typescript theme={null}
import { Pod, Image } from "@beamcloud/beam-js";

// Create a Pod that runs a simple HTTP server
const pod = new Pod({
  name: "web-server",
  cpu: 2,
  memory: "512Mi",
  image: new Image({
    baseImage: "python:3.9-slim",
    pythonPackages: ["requests"],
  }),
  ports: [8000],
});

// Create the pod container
const result = await pod.create(["python", "-m", "http.server", "8000"]);

console.log("Container ID:", result.containerId);
console.log("URL:", result.url);
```

### `Pod.create()`

Create a new container that runs until it completes or is explicitly killed.

```typescript theme={null}
const result = await pod.create(["python", "app.py"]);
console.log("Pod created successfully:", result.url);
```

<ParamField body="entrypoint" type="string[]">
  The command to run in the container.
</ParamField>

# Storage

## `Volume`

Creates a Volume instance.

When your container runs, your volume will be available at `./{mountPath}` and `/volumes/{name}`.

```typescript theme={null}
import { Volume } from "@beamcloud/beam-js";

const volume = new Volume("model-weights", "./weights");
await volume.getOrCreate();

// Use with Pod or Sandbox
const pod = new Pod({
  name: "my-pod",
  volumes: [volume],
  // ... other config
});
```

<ParamField body="name" type="string" required>
  The name of the volume, a descriptive identifier for the data volume.
</ParamField>

<ParamField body="mountPath" type="string" required>
  The path where the volume is mounted within the container environment.
</ParamField>

### `Volume.getOrCreate()`

Get or create the volume in the platform.

```typescript theme={null}
const success = await volume.getOrCreate();
console.log("Volume ready:", volume.ready);
```

# Utils

## `TaskPolicy`

Task policy for managing the lifecycle of individual tasks.

```typescript theme={null}
import { TaskPolicy } from "@beamcloud/beam-js";

const policy = new TaskPolicy({
  maxRetries: 3,
  timeout: 300,
  ttl: 3600,
});
```

<ParamField body="maxRetries" type="number" default="0">
  The maximum number of times a task will be retried if the container crashes.
</ParamField>

<ParamField body="timeout" type="number" default="0">
  The maximum number of seconds a task can run before it times out. Set it to -1
  to disable the timeout.
</ParamField>

<ParamField body="ttl" type="number" default="0">
  The expiration time for a task in seconds. Must be greater than 0 and less
  than 24 hours (86400 seconds).
</ParamField>

# Types

The TypeScript SDK includes comprehensive type definitions for all resources:

* `GpuType`: Enum of available GPU types (T4, A10G, A100, H100, etc.)
* `GpuTypeAlias`: Union type allowing both enum values and string literals for GPU specification
* `PythonVersion`: Enum of supported Python versions
* `PythonVersionAlias`: Union type allowing both enum values and string literals for Python version specification
* `TaskStatus`: Enum of task statuses (PENDING, RUNNING, COMPLETE, etc.)
* `DeploymentData`: Interface for deployment data
* `TaskData`: Interface for task data
* `ExecOptions`: Options for sandbox command execution (cwd, env)
* `PodInstanceData`: Interface for pod instance data
* And many more...

```typescript theme={null}
import {
  GpuType,
  GpuTypeAlias,
  PythonVersion,
  PythonVersionAlias,
  TaskStatus,
  DeploymentData,
} from "@beamcloud/beam-js";

// Use types for better TypeScript support
const gpu: GpuType = GpuType.A10G; // Enum approach
const gpuAlias: GpuTypeAlias = "A10G"; // String literal approach
const anotherGpu: GpuTypeAlias = GpuType.H100; // Both work with GpuTypeAlias

const python: PythonVersion = PythonVersion.Python311; // Enum approach
const pythonAlias: PythonVersionAlias = "python3.11"; // String literal approach
const anotherPython: PythonVersionAlias = PythonVersion.Python310; // Both work with PythonVersionAlias

// Both approaches work seamlessly for any alias type
function createResource(gpu: GpuTypeAlias, python: PythonVersionAlias) {
  console.log(`Using GPU: ${gpu}, Python: ${python}`);
}

createResource(GpuType.H100, PythonVersion.Python311); // ✅ Works with enums
createResource("H100", "python3.11"); // ✅ Works with strings
createResource("A10G", PythonVersion.Python310); // ✅ Works with mixed approaches
```

## `ExecOptions`

Options for configuring command execution in a sandbox.

```typescript theme={null}
import { ExecOptions } from "@beamcloud/beam-js";

const opts: ExecOptions = {
  cwd: "/app",
  env: { NODE_ENV: "production", DEBUG: "true" },
};

const process = await instance.exec(["node", "server.js"], opts);
```

<ParamField body="cwd" type="string">
  The working directory for the command.
</ParamField>

<ParamField body="env" type="Record<string, string>">
  Environment variables to set for the command.
</ParamField>
