Skip to main content

Overview

The buntime.sh TypeScript SDK provides a type-safe, modern interface for interacting with the buntime.sh API. Built with TypeScript, fully async/await compatible, and designed for both Node.js and Bun runtimes.

Why Use the SDK?

Type Safety

Full TypeScript support with autocomplete and type checking

Error Handling

Structured error types with helpful messages

Automatic Retries

Built-in retry logic for transient failures

Streaming Support

Stream execution output in real-time

Installation

Quick Start

Client Configuration

Basic Configuration

Advanced Configuration

Core Concepts

Sessions

Sessions are isolated execution environments. Create a session once and reuse it across multiple executions:

Execution

Execute code or commands in a session:

Files

Manage files in a session:

Error Handling

The SDK throws typed errors that you can catch and handle:

Complete Example

Here’s a full example showing common SDK patterns:

TypeScript Types

The SDK exports all types for your convenience:

Best Practices

Never hardcode your API key. Use environment variables or a secrets manager.
Create a session once and reuse it for multiple operations rather than creating a new session for each execution.
Always delete sessions when you’re done to free resources.
Use try-catch blocks and check for specific error types.
Check execution metrics to optimize performance.

Framework Integration

Express

Next.js API Route

Next Steps

SDK Reference

Explore all SDK methods and options

API Reference

View the underlying REST API

Examples

Browse code examples

AI Integration

Integrate with AI agents
Questions? Join our Discord community or check out the GitHub repository.