Skip to main content
The Hopx JavaScript/TypeScript SDK provides a simple, intuitive API for creating and managing sandboxes. This reference covers all classes, methods, and types available in the SDK.

Installation

npm install @hopx-ai/sdk
# or
yarn add @hopx-ai/sdk
# or
pnpm add @hopx-ai/sdk

Quick Start

import { Sandbox } from '@hopx-ai/sdk';

// Create sandbox
const sandbox = await Sandbox.create({
  template: 'code-interpreter'
});

// Execute code
const result = await sandbox.runCode("console.log('Hello, World!')");
console.log(result.stdout);

// Cleanup
await sandbox.kill();

Main Classes

Resources

Types

SandboxInfo

Sandbox information and properties

ExecutionResult

Code execution results with rich outputs

CommandResponse

Command execution results

FileInfo

File and directory information

Error Handling


SDK Structure

@hopx-ai/sdk/
├── Sandbox              # Main class
├── Template             # Template builder class
├── types/               # TypeScript types
│   ├── SandboxInfo
│   ├── ExecutionResult
│   ├── CommandResponse
│   └── FileInfo
├── template/            # Template building
│   ├── builder          # Template class
│   ├── types            # BuildOptions, BuildResult, etc.
│   └── build-flow       # Build execution
├── errors/              # Exception classes
│   ├── HopxError
│   ├── APIError
│   ├── AuthenticationError
│   └── ...
└── resources/           # Resource classes
    ├── Files
    ├── Commands
    ├── Desktop
    └── EnvironmentVariables

Next Steps