Repository navigation
v0.6.0
SDK Runner & Network Controls
This release enables seamless integration of Capsule into existing applications and adds network-level security controls for sandboxed tasks.
What's New
SDK Runner — run() Function
Both SDKs now include an async run() function that executes Capsule tasks as a subprocess, making it easy to integrate sandboxed execution into any existing project, no CLI orchestration needed. Just call run() from your application code and execute it with python main.py, npx tsx main.ts or your usual runner.
TypeScript / JavaScript
import { run } from '@capsule-run/sdk/runner';
const result = await run({
file: './capsule.ts',
args: ['code to execute']
});Python
from capsule import run
result = await run(
file="./capsule.py",
args=["code to execute"]
)Allowed Hosts — Network Whitelist
Tasks can now restrict outgoing HTTP requests to an explicit list of domains. Wildcard patterns are supported.
| Language | Parameter | Default |
|---|---|---|
| Python | allowed_hosts |
["*"] (all) |
| TypeScript | allowedHosts |
["*"] (all) |
export const main = task({
name: "main",
allowedHosts: ["api.openai.com", "*.anthropic.com"],
}, async () => { ... });@task(name="main", allowed_hosts=["api.openai.com", "*.anthropic.com"])
def main():
...Improved WASM Compilation & Caching
- Each source file now produces its own dedicated
.wasmand.cwasm(pre-compiled cache) artifacts, named after the file (e.g.capsule run main.py→main.wasm+main.cwasm). - Task introspection now only considers the
maintask from the entry file, preventing conflicts when multiple files in the same folder define amaintask.
Notes
- The
run()function requires@capsule-run/clias a dependency in JavaScript projects. - By default, all outbound HTTP requests are allowed (
["*"]). SetallowedHosts/allowed_hoststo restrict access. - Wildcard domain patterns (e.g.
*.anthropic.com) match any subdomain.