e2b

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package e2b runs sandboxes on E2B: each is a small VM that starts in under a second. It talks to E2B's HTTP API directly, so it needs no SDK; the TS runtime has the same adapter (E2BSandbox). A sandbox shuts itself down at its timeout, which the runtime pushes back while the thread uses it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Envelope

func Envelope(message any, flags byte) []byte

Envelope is one Connect streaming message: a flags byte, a 4-byte length, the JSON.

func ReadFrame

func ReadFrame(r *bufio.Reader) (end bool, payload []byte, err error)

ReadFrame reads one message of a Connect stream. end is true for the last, which says whether the call failed.

Types

type Options

type Options struct {
	// Template is what each sandbox starts from. Default "base".
	Template string
	// Network is "none" (the default), "all", or "allow" with Allow: only
	// these hosts.
	Network ports.SandboxNetwork
	// Domain defaults to e2b.app.
	Domain string
	// APIURL defaults to https://api.<domain>.
	APIURL string
	// SandboxURL sends every call to one sandbox here instead of
	// https://49983-<id>.<domain>, naming the sandbox in a header. For
	// tests and proxies.
	SandboxURL string
	// HTTPClient defaults to http.DefaultClient.
	HTTPClient *http.Client
}

Options shapes the provider.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider makes E2B sandboxes.

func New

func New(apiKey string, opts Options) (*Provider, error)

New returns the provider. The API key is required.

func (*Provider) Connect

func (p *Provider) Connect(ctx context.Context, sandboxID string) (ports.Sandbox, error)

Connect implements ports.SandboxProvider.

func (*Provider) Create

Create implements ports.SandboxProvider.

func (*Provider) Name

func (p *Provider) Name() string

Name implements ports.SandboxProvider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL