Skip to content

An open-source, faster Devin alternative

TypeScript

Rebrand SDKs: opensandbox -> @opencomputer/sdk (npm) and opencomputer (pip)

motatoes97e901f77ec5
diff --git a/docs/introduction.mdx b/docs/introduction.mdx
index a1cd14b2..52647ee5 100644
--- a/docs/introduction.mdx
+++ b/docs/introduction.mdx
@@ -31,11 +31,11 @@ OpenSandbox provides first-class SDKs for TypeScript and Python with identical A
<CodeGroup>
```bash npm
-npm install opensandbox
+npm install @opencomputer/sdk
```
```bash pip
-pip install opensandbox-sdk
+pip install opencomputer
```
</CodeGroup>
@@ -45,7 +45,7 @@ pip install opensandbox-sdk
<CodeGroup>
```typescript TypeScript
-import { Sandbox } from 'opensandbox';
+import { Sandbox } from '@opencomputer/sdk';
const sandbox = await Sandbox.create({ template: 'base' });
@@ -57,7 +57,7 @@ await sandbox.kill();
```python Python
import asyncio
-from opensandbox import Sandbox
+from opencomputer import Sandbox
async def main():
sandbox = await Sandbox.create(template='base')
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index 5a1bf0a9..4a12718b 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -12,11 +12,11 @@ Sign up at [app.opencomputer.dev](https://app.opencomputer.dev) and grab your AP
<CodeGroup>
```bash npm
-npm install opensandbox
+npm install @opencomputer/sdk
```
```bash pip
-pip install opensandbox-sdk
+pip install opencomputer
```
</CodeGroup>
@@ -32,7 +32,7 @@ export OPENSANDBOX_API_KEY="your-api-key"
<CodeGroup>
```typescript TypeScript
-import { Sandbox } from 'opensandbox';
+import { Sandbox } from '@opencomputer/sdk';
const sandbox = await Sandbox.create({
template: 'base',
@@ -43,7 +43,7 @@ console.log(`Sandbox created: ${sandbox.sandboxId}`);
```
```python Python
-from opensandbox import Sandbox
+from opencomputer import Sandbox
sandbox = await Sandbox.create(template='base', timeout=300)
print(f"Sandbox created: {sandbox.sandbox_id}")
diff --git a/docs/sdks/python/overview.mdx b/docs/sdks/python/overview.mdx
index e2a0892d..7ea03b5c 100644
--- a/docs/sdks/python/overview.mdx
+++ b/docs/sdks/python/overview.mdx
@@ -6,7 +6,7 @@ description: "Full reference for the OpenSandbox Python SDK"
## Installation
```bash
-pip install opensandbox-sdk
+pip install opencomputer
```
**Requirements:** Python 3.10+
@@ -29,7 +29,7 @@ The Python SDK is fully async and provides the same modules as the TypeScript SD
```python
import asyncio
-from opensandbox import Sandbox
+from opencomputer import Sandbox
async def main():
sandbox = await Sandbox.create(template='base')
@@ -56,7 +56,7 @@ asyncio.run(main())
## Exports
```python
-from opensandbox import (
+from opencomputer import (
Sandbox,
Filesystem,
Commands,
diff --git a/docs/sdks/python/sandbox.mdx b/docs/sdks/python/sandbox.mdx
index 1fede4cd..7c629402 100644
--- a/docs/sdks/python/sandbox.mdx
+++ b/docs/sdks/python/sandbox.mdx
@@ -8,7 +8,7 @@ The `Sandbox` class is the main entry point to OpenSandbox. It supports both man
## Creating a Sandbox
```python
-from opensandbox import Sandbox
+from opencomputer import Sandbox
sandbox = await Sandbox.create(
template='base',
diff --git a/docs/sdks/python/templates.mdx b/docs/sdks/python/templates.mdx
index bd70b3dc..e683bb3f 100644
--- a/docs/sdks/python/templates.mdx
+++ b/docs/sdks/python/templates.mdx
@@ -8,7 +8,7 @@ Templates let you create reusable sandbox images from Dockerfiles. Pre-install l
## Building a Template
```python
-from opensandbox import Template
+from opencomputer import Template
templates = Template(api_url, api_key)
diff --git a/docs/sdks/typescript/overview.mdx b/docs/sdks/typescript/overview.mdx
index d5191734..72962f79 100644
--- a/docs/sdks/typescript/overview.mdx
+++ b/docs/sdks/typescript/overview.mdx
@@ -6,7 +6,7 @@ description: "Full reference for the OpenSandbox TypeScript/JavaScript SDK"
## Installation
```bash
-npm install opensandbox
+npm install @opencomputer/sdk
```
## Overview
@@ -24,7 +24,7 @@ The TypeScript SDK provides five main modules:
## Quick Example
```typescript
-import { Sandbox } from 'opensandbox';
+import { Sandbox } from '@opencomputer/sdk';
// Create a sandbox
const sandbox = await Sandbox.create({ template: 'base' });
@@ -48,28 +48,28 @@ await sandbox.kill();
import {
Sandbox,
type SandboxOpts,
-} from 'opensandbox';
+} from '@opencomputer/sdk';
// Also available:
import {
Filesystem,
type EntryInfo,
-} from 'opensandbox';
+} from '@opencomputer/sdk';
import {
Commands,
type ProcessResult,
type RunOpts,
-} from 'opensandbox';
+} from '@opencomputer/sdk';
import {
Pty,
type PtySession,
type PtyOpts,
-} from 'opensandbox';
+} from '@opencomputer/sdk';
import {
Templates,
type TemplateInfo,
-} from 'opensandbox';
+} from '@opencomputer/sdk';
```
diff --git a/docs/sdks/typescript/sandbox.mdx b/docs/sdks/typescript/sandbox.mdx
index 55d1bb4d..be943814 100644
--- a/docs/sdks/typescript/sandbox.mdx
+++ b/docs/sdks/typescript/sandbox.mdx
@@ -8,7 +8,7 @@ The `Sandbox` class is the main entry point to OpenSandbox. Use it to create new
## Creating a Sandbox
```typescript
-import { Sandbox } from 'opensandbox';
+import { Sandbox } from '@opencomputer/sdk';
const sandbox = await Sandbox.create({
template: 'base',
diff --git a/docs/sdks/typescript/templates.mdx b/docs/sdks/typescript/templates.mdx
index 9757b582..c4b7421c 100644
--- a/docs/sdks/typescript/templates.mdx
+++ b/docs/sdks/typescript/templates.mdx
@@ -8,7 +8,7 @@ Templates let you create reusable sandbox images from Dockerfiles. Pre-install l
## Building a Template
```typescript
-import { Templates } from 'opensandbox';
+import { Templates } from '@opencomputer/sdk';
const templates = new Templates(apiUrl, apiKey);
diff --git a/examples/test.py b/examples/test.py
index 936e7118..5e196bd7 100644
--- a/examples/test.py
+++ b/examples/test.py
@@ -3,7 +3,7 @@ import sys
sys.path.insert(0, "../sdks/python")
-from opensandbox import Sandbox
+from opencomputer import Sandbox
async def main():
diff --git a/examples/test_templates.py b/examples/test_templates.py
new file mode 100644
index 00000000..779aaebb
--- /dev/null
+++ b/examples/test_templates.py
@@ -0,0 +1,124 @@
+"""Test script for the OpenSandbox Templates API.
+
+Templates are standalone — they're not accessed through a Sandbox instance.
+They let you build custom container images from Dockerfiles, which can then
+be used as the `template` parameter when creating sandboxes.
+
+Usage:
+ python test_templates.py [API_URL] [API_KEY]
+
+Defaults to http://localhost:8080 with no API key.
+"""
+
+import asyncio
+import sys
+import os
+
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "sdks", "python"))
+
+from opencomputer import Sandbox, Template
+import httpx
+
+
+async def main():
+ api_url = sys.argv[1] if len(sys.argv) > 1 else os.environ.get("OPENSANDBOX_API_URL", "http://localhost:8080")
+ api_key = sys.argv[2] if len(sys.argv) > 2 else os.environ.get("OPENSANDBOX_API_KEY", "")
+
+ api_url = api_url.rstrip("/")
+ api_base = api_url if api_url.endswith("/api") else f"{api_url}/api"
+
+ headers = {}
+ if api_key:
+ headers["X-API-Key"] = api_key
+
+ client = httpx.AsyncClient(base_url=api_base, headers=headers, timeout=300.0)
+ templates = Template._from_client(client)
+
+ try:
+ # ── 1. List default templates ────────────────────────────────
+ print("=== 1. List default templates ===")
+ all_templates = await templates.list()
+ print(f"Found {len(all_templates)} templates:")
+ for t in all_templates:
+ print(f" - {t.name} (id={t.template_id}, tag={t.tag}, status={t.status})")
+
+ # ── 2. Get a specific template ───────────────────────────────
+ print("\n=== 2. Get 'base' template ===")
+ base = await templates.get("base")
+ print(f" name={base.name}, id={base.template_id}, tag={base.tag}, status={base.status}")
+
+ # ── 3. Build a custom template ───────────────────────────────
+ print("\n=== 3. Build custom template 'test-custom' ===")
+ print(" (This runs `podman build` synchronously — may take a minute...)")
+ custom = await templates.build("test-custom", """\
+FROM ubuntu:22.04
+RUN apt-get update -qq && apt-get install -y -qq curl > /dev/null 2>&1
+RUN echo "custom template ready" > /etc/motd
+""")
+ print(f" Built! id={custom.template_id}, name={custom.name}, status={custom.status}")
+
+ # ── 4. Verify it shows up in the list ────────────────────────
+ print("\n=== 4. Verify template appears in list ===")
+ all_templates = await templates.list()
+ names = [t.name for t in all_templates]
+ assert "test-custom" in names, f"Expected 'test-custom' in {names}"
+ print(f" OK — found {len(all_templates)} templates: {names}")
+
+ # ── 5. Get the custom template by name ───────────────────────
+ print("\n=== 5. Get custom template ===")
+ fetched = await templates.get("test-custom")
+ print(f" name={fetched.name}, status={fetched.status}")
+
+ # ── 6. Create a sandbox using the custom template ────────────
+ print("\n=== 6. Create sandbox with custom template ===")
+ sandbox = await Sandbox.create(
+ template="test-custom",
+ timeout=60,
+ api_url=api_url,
+ api_key=api_key,
+ )
+ print(f" Sandbox created: {sandbox.sandbox_id}")
+
+ # Verify the custom image works
+ result = await sandbox.commands.run("cat /etc/motd")
+ print(f" /etc/motd says: {result.stdout.strip()}")
+ assert "custom template ready" in result.stdout, f"Unexpected motd: {result.stdout}"
+
+ result = await sandbox.commands.run("curl --version | head -1")
+ print(f" curl: {result.stdout.strip()}")
+
+ await sandbox.kill()
+ print(" Sandbox killed.")
+
+ # ── 7. Delete the custom template ────────────────────────────
+ print("\n=== 7. Delete custom template ===")
+ await templates.delete("test-custom")
+ print(" Deleted 'test-custom'.")
+
+ # ── 8. Verify deletion ───────────────────────────────────────
+ print("\n=== 8. Verify deletion ===")
+ try:
+ await templates.get("test-custom")
+ print(" ERROR: template still exists after deletion!")
+ except httpx.HTTPStatusError as e:
+ if e.response.status_code == 404:
+ print(" OK — template not found (404), as expected.")
+ else:
+ print(f" Unexpected error: {e}")
+
+ # Final list
+ all_templates = await templates.list()
+ names = [t.name for t in all_templates]
+ assert "test-custom" not in names, f"'test-custom' still in {names}"
+ print(f" Remaining templates: {names}")
+
+ print("\n✅ All template tests passed!")
+
+ except Exception as e:
+ print(f"\n❌ Test failed: {e}")
+ raise
+ finally:
+ await client.aclose()
+
+
+asyncio.run(main())
diff --git a/examples/test_templates.ts b/examples/test_templates.ts
new file mode 100644
index 00000000..5571b107
--- /dev/null
+++ b/examples/test_templates.ts
@@ -0,0 +1,125 @@
+/**
+ * Test script for the OpenSandbox Templates API.
+ *
+ * Templates are standalone — they're not accessed through a Sandbox instance.
+ * They let you build custom container images from Dockerfiles, which can then
+ * be used as the `template` parameter when creating sandboxes.
+ *
+ * Usage:
+ * npx tsx test_templates.ts [API_URL] [API_KEY]
+ *
+ * Defaults to http://localhost:8080 with no API key.
+ */
+
+import { Sandbox } from "../sdks/typescript/src/index";
+import { Templates, type TemplateInfo } from "../sdks/typescript/src/template";
+
+function resolveApiUrl(url: string): string {
+ const base = url.replace(/\/+$/, "");
+ return base.endsWith("/api") ? base : `${base}/api`;
+}
+
+async function main() {
+ const apiUrl = resolveApiUrl(
+ process.argv[2] ?? process.env.OPENSANDBOX_API_URL ?? "http://localhost:8080"
+ );
+ const apiKey = process.argv[3] ?? process.env.OPENSANDBOX_API_KEY ?? "";
+ const rawUrl = process.argv[2] ?? process.env.OPENSANDBOX_API_URL ?? "http://localhost:8080";
+
+ const templates = new Templates(apiUrl, apiKey);
+
+ // ── 1. List default templates ────────────────────────────────
+ console.log("=== 1. List default templates ===");
+ let allTemplates = await templates.list();
+ console.log(`Found ${allTemplates.length} templates:`);
+ for (const t of allTemplates) {
+ console.log(` - ${t.name} (id=${t.templateID}, tag=${t.tag}, status=${t.status})`);
+ }
+
+ // ── 2. Get a specific template ───────────────────────────────
+ console.log("\n=== 2. Get 'base' template ===");
+ const base = await templates.get("base");
+ console.log(` name=${base.name}, id=${base.templateID}, tag=${base.tag}, status=${base.status}`);
+
+ // ── 3. Build a custom template ───────────────────────────────
+ console.log("\n=== 3. Build custom template 'test-custom' ===");
+ console.log(" (This runs `podman build` synchronously — may take a minute...)");
+ const custom = await templates.build(
+ "test-custom",
+ `FROM ubuntu:22.04
+RUN apt-get update -qq && apt-get install -y -qq curl > /dev/null 2>&1
+RUN echo "custom template ready" > /etc/motd
+`
+ );
+ console.log(` Built! id=${custom.templateID}, name=${custom.name}, status=${custom.status}`);
+
+ // ── 4. Verify it shows up in the list ────────────────────────
+ console.log("\n=== 4. Verify template appears in list ===");
+ allTemplates = await templates.list();
+ const names = allTemplates.map((t) => t.name);
+ if (!names.includes("test-custom")) {
+ throw new Error(`Expected 'test-custom' in ${JSON.stringify(names)}`);
+ }
+ console.log(` OK — found ${allTemplates.length} templates: ${JSON.stringify(names)}`);
+
+ // ── 5. Get the custom template by name ───────────────────────
+ console.log("\n=== 5. Get custom template ===");
+ const fetched = await templates.get("test-custom");
+ console.log(` name=${fetched.name}, status=${fetched.status}`);
+
+ // ── 6. Create a sandbox using the custom template ────────────
+ console.log("\n=== 6. Create sandbox with custom template ===");
+ const sandbox = await Sandbox.create({
+ template: "test-custom",
+ timeout: 60,
+ apiUrl: rawUrl,
+ apiKey,
+ });
+ console.log(` Sandbox created: ${sandbox.sandboxId}`);
+
+ // Verify the custom image works
+ const motd = await sandbox.commands.run("cat /etc/motd");
+ console.log(` /etc/motd says: ${motd.stdout.trim()}`);
+ if (!motd.stdout.includes("custom template ready")) {
+ throw new Error(`Unexpected motd: ${motd.stdout}`);
+ }
+
+ const curl = await sandbox.commands.run("curl --version | head -1");
+ console.log(` curl: ${curl.stdout.trim()}`);
+
+ await sandbox.kill();
+ console.log(" Sandbox killed.");
+
+ // ── 7. Delete the custom template ────────────────────────────
+ console.log("\n=== 7. Delete custom template ===");
+ await templates.delete("test-custom");
+ console.log(" Deleted 'test-custom'.");
+
+ // ── 8. Verify deletion ───────────────────────────────────────
+ console.log("\n=== 8. Verify deletion ===");
+ try {
+ await templates.get("test-custom");
+ console.log(" ERROR: template still exists after deletion!");
+ } catch (e: any) {
+ if (e.message.includes("404")) {
+ console.log(" OK — template not found (404), as expected.");
+ } else {
+ console.log(` Unexpected error: ${e.message}`);
+ }
+ }
+
+ // Final list
+ allTemplates = await templates.list();
+ const remaining = allTemplates.map((t) => t.name);
+ if (remaining.includes("test-custom")) {
+ throw new Error(`'test-custom' still in ${JSON.stringify(remaining)}`);
+ }
+ console.log(` Remaining templates: ${JSON.stringify(remaining)}`);
+
+ console.log("\n✅ All template tests passed!");
+}
+
+main().catch((err) => {
+ console.error(`\n❌ Test failed: ${err.message}`);
+ process.exit(1);
+});
diff --git a/sdks/python/README.md b/sdks/python/README.md
index cc2b1acf..c8eae6e9 100644
--- a/sdks/python/README.md
+++ b/sdks/python/README.md
@@ -1,18 +1,18 @@
-# opensandbox-sdk
+# opencomputer
-Python SDK for [OpenSandbox](https://github.com/diggerhq/opensandbox) — an open-source, E2B-compatible sandbox platform.
+Python SDK for [OpenComputer](https://github.com/diggerhq/opensandbox) — cloud sandbox platform.
## Install
```bash
-pip install opensandbox-sdk
+pip install opencomputer
```
## Quick Start
```python
import asyncio
-from opensandbox import Sandbox
+from opencomputer import Sandbox
async def main():
sandbox = await Sandbox.create(template="base")
diff --git a/sdks/python/opencomputer/__init__.py b/sdks/python/opencomputer/__init__.py
new file mode 100644
index 00000000..a506de59
--- /dev/null
+++ b/sdks/python/opencomputer/__init__.py
@@ -0,0 +1,19 @@
+"""OpenComputer Python SDK - cloud sandbox platform."""
+
+from opencomputer.sandbox import Sandbox
+from opencomputer.filesystem import Filesystem
+from opencomputer.commands import Commands, ProcessResult
+from opencomputer.pty import Pty, PtySession
+from opencomputer.template import Template
+
+__all__ = [
+ "Sandbox",
+ "Filesystem",
+ "Commands",
+ "ProcessResult",
+ "Pty",
+ "PtySession",
+ "Template",
+]
+
+__version__ = "0.3.0"
diff --git a/sdks/python/opensandbox/commands.py b/sdks/python/opencomputer/commands.py
similarity index 100%
rename from sdks/python/opensandbox/commands.py
rename to sdks/python/opencomputer/commands.py
diff --git a/sdks/python/opensandbox/filesystem.py b/sdks/python/opencomputer/filesystem.py
similarity index 100%
rename from sdks/python/opensandbox/filesystem.py
rename to sdks/python/opencomputer/filesystem.py
diff --git a/sdks/python/opensandbox/pty.py b/sdks/python/opencomputer/pty.py
similarity index 100%
rename from sdks/python/opensandbox/pty.py
rename to sdks/python/opencomputer/pty.py
diff --git a/sdks/python/opensandbox/sandbox.py b/sdks/python/opencomputer/sandbox.py
similarity index 98%
rename from sdks/python/opensandbox/sandbox.py
rename to sdks/python/opencomputer/sandbox.py
index 3fa37b2d..b8dc90a4 100644
--- a/sdks/python/opensandbox/sandbox.py
+++ b/sdks/python/opencomputer/sandbox.py
@@ -8,9 +8,9 @@ from typing import Any
import httpx
-from opensandbox.commands import Commands
-from opensandbox.filesystem import Filesystem
-from opensandbox.pty import Pty
+from opencomputer.commands import Commands
+from opencomputer.filesystem import Filesystem
+from opencomputer.pty import Pty
@dataclass
diff --git a/sdks/python/opensandbox/template.py b/sdks/python/opencomputer/template.py
similarity index 100%
rename from sdks/python/opensandbox/template.py
rename to sdks/python/opencomputer/template.py
diff --git a/sdks/python/opensandbox/__init__.py b/sdks/python/opensandbox/__init__.py
deleted file mode 100644
index 919b19dd..00000000
--- a/sdks/python/opensandbox/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-"""OpenSandbox Python SDK - E2B-compatible sandbox platform."""
-
-from opensandbox.sandbox import Sandbox
-from opensandbox.filesystem import Filesystem
-from opensandbox.commands import Commands, ProcessResult
-from opensandbox.pty import Pty, PtySession
-from opensandbox.template import Template
-
-__all__ = [
- "Sandbox",
- "Filesystem",
- "Commands",
- "ProcessResult",
- "Pty",
- "PtySession",
- "Template",
-]
-
-__version__ = "0.3.0"
diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml
index 351e7346..cef72065 100644
--- a/sdks/python/pyproject.toml
+++ b/sdks/python/pyproject.toml
@@ -3,16 +3,16 @@ requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
-name = "opensandbox-sdk"
+name = "opencomputer"
version = "0.3.0"
-description = "Python SDK for OpenSandbox - E2B-compatible sandbox platform"
+description = "Python SDK for OpenComputer - cloud sandbox platform"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
authors = [
- { name = "OpenSandbox" },
+ { name = "OpenComputer" },
]
-keywords = ["sandbox", "opensandbox", "e2b", "cloud", "containers", "code-execution"]
+keywords = ["sandbox", "opencomputer", "cloud", "containers", "code-execution"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
@@ -42,5 +42,5 @@ Documentation = "https://github.com/diggerhq/opensandbox/tree/main/sdks/python"
Issues = "https://github.com/diggerhq/opensandbox/issues"
[tool.hatch.build.targets.wheel]
-packages = ["opensandbox"]
+packages = ["opencomputer"]
exclude = ["__pycache__"]
diff --git a/sdks/typescript/README.md b/sdks/typescript/README.md
index 4205744f..a00c2472 100644
--- a/sdks/typescript/README.md
+++ b/sdks/typescript/README.md
@@ -1,17 +1,17 @@
-# opensandbox
+# @opencomputer/sdk
-TypeScript SDK for [OpenSandbox](https://github.com/diggerhq/opensandbox) — an open-source, E2B-compatible sandbox platform.
+TypeScript SDK for [OpenComputer](https://github.com/diggerhq/opensandbox) — cloud sandbox platform.
## Install
```bash
-npm install opensandbox
+npm install @opencomputer/sdk
```
## Quick Start
```typescript
-import { Sandbox } from "opensandbox";
+import { Sandbox } from "@opencomputer/sdk";
const sandbox = await Sandbox.create({ template: "base" });
diff --git a/sdks/typescript/package.json b/sdks/typescript/package.json
index d05006dc..9903bf17 100644
--- a/sdks/typescript/package.json
+++ b/sdks/typescript/package.json
@@ -1,7 +1,7 @@
{
- "name": "opensandbox",
+ "name": "@opencomputer/sdk",
"version": "0.4.0",
- "description": "TypeScript SDK for OpenSandbox - E2B-compatible sandbox platform",
+ "description": "TypeScript SDK for OpenComputer - cloud sandbox platform",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -22,13 +22,13 @@
},
"keywords": [
"sandbox",
- "opensandbox",
+ "opencomputer",
"e2b",
"cloud",
"containers",
"code-execution"
],
- "author": "OpenSandbox",
+ "author": "OpenComputer",
"license": "MIT",
"repository": {
"type": "git",