{"id":50721578,"url":"https://github.com/matiasinsaurralde/go-e2b","last_synced_at":"2026-06-10T00:30:25.447Z","repository":{"id":349075708,"uuid":"1200946724","full_name":"matiasinsaurralde/go-e2b","owner":"matiasinsaurralde","description":"Unofficial Go SDK for E2B cloud sandboxes — create, manage, and run commands in secure microVMs.","archived":false,"fork":false,"pushed_at":"2026-05-26T05:44:41.000Z","size":116,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-26T07:18:08.720Z","etag":null,"topics":["ai-agent","e2b","llm","microvm","sandbox"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matiasinsaurralde.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-04T02:42:21.000Z","updated_at":"2026-05-26T05:44:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/matiasinsaurralde/go-e2b","commit_stats":null,"previous_names":["matiasinsaurralde/go-e2b"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matiasinsaurralde/go-e2b","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasinsaurralde%2Fgo-e2b","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasinsaurralde%2Fgo-e2b/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasinsaurralde%2Fgo-e2b/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasinsaurralde%2Fgo-e2b/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matiasinsaurralde","download_url":"https://codeload.github.com/matiasinsaurralde/go-e2b/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasinsaurralde%2Fgo-e2b/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34132030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","e2b","llm","microvm","sandbox"],"created_at":"2026-06-10T00:30:24.720Z","updated_at":"2026-06-10T00:30:25.439Z","avatar_url":"https://github.com/matiasinsaurralde.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-e2b\n\n[![CI](https://github.com/matiasinsaurralde/go-e2b/actions/workflows/ci.yml/badge.svg)](https://github.com/matiasinsaurralde/go-e2b/actions/workflows/ci.yml)\n[![Lint](https://github.com/matiasinsaurralde/go-e2b/actions/workflows/lint.yml/badge.svg)](https://github.com/matiasinsaurralde/go-e2b/actions/workflows/lint.yml)\n[![Security](https://github.com/matiasinsaurralde/go-e2b/actions/workflows/security.yml/badge.svg)](https://github.com/matiasinsaurralde/go-e2b/actions/workflows/security.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/matiasinsaurralde/go-e2b.svg)](https://pkg.go.dev/github.com/matiasinsaurralde/go-e2b)\n[![License: MIT](https://img.shields.io/github/license/matiasinsaurralde/go-e2b)](LICENSE)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/matiasinsaurralde/go-e2b)](go.mod)\n\nA Go SDK for the [E2B](https://e2b.dev) cloud sandbox API. E2B provides lightweight microVMs you can use to safely run arbitrary code in ephemeral environments.\n\n## Installation\n\n```sh\ngo get github.com/matiasinsaurralde/go-e2b\n```\n\n## Requirements\n\n- Go 1.25+\n- An [E2B API key](https://e2b.dev/dashboard)\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"log\"\n    \"os\"\n\n    e2b \"github.com/matiasinsaurralde/go-e2b\"\n)\n\nfunc main() {\n    client, err := e2b.NewClient(e2b.ClientConfig{\n        APIKey: os.Getenv(\"E2B_API_KEY\"),\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    sandbox, err := client.NewSandbox(context.Background(), e2b.SandboxConfig{\n        Template: \"base\",\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer sandbox.Close()\n\n    result, err := sandbox.Commands.Run(\"echo\", []string{\"hello, world\"})\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    fmt.Println(result.Stdout)     // hello, world\n    fmt.Println(result.ExitCode)   // 0\n}\n```\n\nSee [examples/](examples/) for more usage patterns.\n\n## Usage\n\n### Creating a Client and Sandbox\n\n```go\nclient, err := e2b.NewClient(e2b.ClientConfig{\n    APIKey:        \"your-api-key\",       // or set E2B_API_KEY env var\n    APIBaseURL:    \"https://api.e2b.app\", // optional\n    SandboxDomain: \"e2b.app\",             // optional\n})\nif err != nil {\n    log.Fatal(err)\n}\n\nsandbox, err := client.NewSandbox(context.Background(), e2b.SandboxConfig{\n    Template: \"base\",               // sandbox template (default: \"base\")\n    Timeout:  300,                  // lifetime in seconds (default: 300)\n    EnvVars:  map[string]string{    // environment variables\n        \"MY_VAR\": \"value\",\n    },\n})\n```\n\nThe `base` template includes Python 3.11, Node.js 20, npm, Yarn, git, and the GitHub CLI.\n\n### Running Commands\n\n```go\n// Simple command\nresult, err := sandbox.Commands.Run(\"python3\", []string{\"-c\", \"print('hello')\"})\n\n// With options\nresult, err := sandbox.Commands.Run(\n    \"bash\", []string{\"-c\", \"echo $FOO\"},\n    e2b.WithEnv(map[string]string{\"FOO\": \"bar\"}),\n    e2b.WithCwd(\"/tmp\"),\n    e2b.WithUser(\"ubuntu\"),\n    e2b.WithTimeout(30 * time.Second),\n)\n\nfmt.Println(result.Stdout)\nfmt.Println(result.Stderr)\nfmt.Println(result.ExitCode)\n```\n\n### Context Support\n\n```go\nctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\ndefer cancel()\n\nclient, err := e2b.NewClient(e2b.ClientConfig{APIKey: apiKey})\nif err != nil {\n    log.Fatal(err)\n}\n\nsandbox, err := client.NewSandbox(ctx, e2b.SandboxConfig{Template: \"base\"})\nif err != nil {\n    log.Fatal(err)\n}\ndefer sandbox.Close()\n\nresult, err := sandbox.Commands.RunWithContext(ctx, \"sleep\", []string{\"5\"})\n```\n\n### Command Options\n\n| Option | Description |\n|--------|-------------|\n| `WithEnv(map[string]string)` | Set environment variables for the command |\n| `WithCwd(string)` | Set the working directory |\n| `WithUser(string)` | Set the user to run the command as |\n| `WithTimeout(time.Duration)` | Set a per-command execution timeout |\n\n## Configuration\n\nConfiguration can be provided via `ClientConfig` / `SandboxConfig` fields or environment variables:\n\n| Field | Env Var | Default | Description |\n|-------|---------|---------|-------------|\n| `ClientConfig.APIKey` | `E2B_API_KEY` | — | E2B API key (required) |\n| `ClientConfig.APIBaseURL` | `E2B_API_URL` | `https://api.e2b.app` | API base URL |\n| `ClientConfig.SandboxDomain` | `E2B_SANDBOX_URL` | `e2b.app` | Sandbox domain |\n| `SandboxConfig.Template` | — | `base` | Sandbox template ID |\n| `SandboxConfig.Timeout` | — | `300` | Sandbox lifetime in seconds |\n\n## Error Handling\n\n```go\nimport e2b \"github.com/matiasinsaurralde/go-e2b\"\n\n_, err := e2b.NewClient(e2b.ClientConfig{APIKey: apiKey})\nswitch {\ncase errors.As(err, \u0026e2b.SandboxNotFoundError{}):\n    // sandbox not found\ncase errors.As(err, \u0026e2b.TimeoutError{}):\n    // operation timed out\ncase errors.As(err, \u0026e2b.Error{}):\n    // generic E2B error\n}\n```\n\n## Development\n\n### Regenerating Proto Bindings\n\nThe Connect RPC client is generated from [e2b-dev/infra](https://github.com/e2b-dev/infra) proto definitions using [buf](https://buf.build).\n\n```sh\n# Install tools\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest\ngo install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest\n\n# Regenerate\nmake generate\n\n# Sync proto from upstream\nmake proto-sync\n\n# Upgrade to latest upstream commit\nmake proto-upgrade\n```\n\nSee [DEVELOPMENT.md](DEVELOPMENT.md) for details.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasinsaurralde%2Fgo-e2b","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatiasinsaurralde%2Fgo-e2b","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasinsaurralde%2Fgo-e2b/lists"}