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

# Introduction

> Serverless sandboxed Bun runtime for AI agents to write and run their own code

<img className="block dark:hidden" src="https://mintcdn.com/buntimesh/McUObpF2Amc22AAt/images/hero-light.svg?fit=max&auto=format&n=McUObpF2Amc22AAt&q=85&s=7e3febdb785581ddb25ee4b397ca1ef9" alt="buntime.sh Hero Light" width="2064" height="1104" data-path="images/hero-light.svg" />

<img className="hidden dark:block" src="https://mintcdn.com/buntimesh/McUObpF2Amc22AAt/images/hero-dark.svg?fit=max&auto=format&n=McUObpF2Amc22AAt&q=85&s=81c41dd25808bba80669043949c0f456" alt="buntime.sh Hero Dark" width="2064" height="1104" data-path="images/hero-dark.svg" />

## What is buntime.sh?

buntime.sh is a serverless API that lets AI agents execute JavaScript and TypeScript code in isolated Bun containers with persistent sessions. Give your AI the ability to write code and immediately see if it works.

<CardGroup cols={2}>
  <Card title="Fast Execution" icon="bolt">
    Sub-3 second cold starts with Bun 1.3 runtime
  </Card>

  <Card title="Persistent Sessions" icon="floppy-disk">
    Files, processes, and databases stay alive during conversations
  </Card>

  <Card title="Web Preview" icon="browser">
    Instantly preview web apps with built-in HMR
  </Card>

  <Card title="Safe Isolation" icon="shield">
    Each session runs in its own container with resource limits
  </Card>
</CardGroup>

## Why buntime.sh?

AI agents write code but can't test it themselves. They guess, give it to users, get error messages back, and guess again. This wastes time and breaks flow.

With buntime.sh, AI agents can:

* ✅ Execute code and see real results instantly
* ✅ Iterate on bugs with actual error messages
* ✅ Build multi-file projects that persist across messages
* ✅ Run web servers and preview them live
* ✅ Work with databases without external services

## Quick Example

```typescript theme={null}
import { Buntime } from 'buntime.sh';

const client = new Buntime({ apiKey: process.env.BUNTIME_API_KEY });

// Create a session
const session = await client.sessions.create();

// Execute code
const result = await client.execute({
  sessionId: session.id,
  code: `
    const data = [1, 2, 3, 4, 5];
    const sum = data.reduce((a, b) => a + b, 0);
    console.log('Sum:', sum);
  `
});

console.log(result.stdout); // "Sum: 15"
```

## Key Features

### One-Shot Execution

Run calculations, fetch data, or execute algorithms without any state management.

### Iterative Development

Build applications over multiple messages. Files persist, processes stay alive, and AI can fix bugs based on real errors.

### Web Applications

Create Express, React, or any HTTP server. Get a live preview URL with automatic hot reload when code updates.

### Built-in Databases

Use Redis, PostgreSQL, MySQL, or SQLite without external services. All powered by Bun 1.3.

### Auto Package Installation

Import any npm package and Bun automatically installs it. No explicit `npm install` needed.

## Use Cases

<AccordionGroup>
  <Accordion icon="calculator" title="Data Processing">
    AI writes code to process CSV, Excel, or PDF files. Sees real output and iterates until correct.
  </Accordion>

  <Accordion icon="globe" title="Web Development">
    AI builds full-stack applications with live preview. Updates code and sees changes instantly.
  </Accordion>

  <Accordion icon="database" title="Database Work">
    AI spins up databases, seeds data, and queries it—all within a session.
  </Accordion>

  <Accordion icon="robot" title="AI Agent Tools">
    Give your AI agents the ability to execute code as part of their tool suite via MCP or function calling.
  </Accordion>
</AccordionGroup>

## Powered by Bun 1.3

buntime.sh leverages the latest Bun features:

* Built-in HMR in `Bun.serve()` for instant hot reload
* Native Redis, MySQL, PostgreSQL, and SQLite support
* Run HTML directly without bundlers
* Async stack traces for better debugging
* Cookie API for web applications
* Blazing fast performance

## Get Started

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get up and running in 5 minutes
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore the complete REST API
  </Card>

  <Card title="TypeScript SDK" icon="js" href="/sdk/introduction">
    Use our type-safe TypeScript client
  </Card>

  <Card title="AI Integration" icon="brain" href="/guides/ai-integration">
    Integrate with Claude, GPT, or custom agents
  </Card>
</CardGroup>

## Pricing

<Card title="Simple, usage-based pricing" icon="dollar-sign">
  * **Free Tier:** 1,000 executions/month
  * **Paid:** \$10/month for 100,000 executions
  * **Enterprise:** Custom limits and SLA

  [View full pricing →](https://buntime.sh/pricing)
</Card>

<Note>
  **Ready to get started?** [Create an account](https://buntime.sh/dashboard) and get your API key in seconds.
</Note>
