Skip to content

Sandbox provider suggestion: Capsule (WebAssembly-based local alternative) #13

Open

Description

@mavdol

Hi @bidah,

Your project looks great! I saw you're using cloud-based providers like E2B and Daytona to sandbox untrusted code. I've been building Capsule, a local alternative based on WebAssembly that's quite straightforward to implement.

In your current architecture, you could add it like this:

import { run } from '@capsule-run/sdk/runner';

const result = await run({
    file: './sandbox.ts',
    args: [untrustedCode], 
});

And in a separate file (sandbox.ts):

import { task } from "@capsule-run/sdk";

export const executeCode = task({
  name: "executeCode",
  compute: "LOW",         
  timeout: "10s",
  ram: "64MB",  
}, (code: string) => { 
  const fn = new Function(code);
  return fn();
});

export const main = task({
  name: "main", 
  compute: "MEDIUM"
}, async (code: string) => {
  return executeCode(code);
});

You can create tasks for your sandboxed actions and set limits per task: CPU (via compute units), memory, filesystem access, timeouts, and retries.

Here's the repo with more examples and documentation: https://github.com/mavdol/capsule

Hope this could be useful for your project!

Activity

  1. bidah commented on Feb 24, 2026

    @bidah
    Collaborator

    this is very interesting, we are pushing a local setup with claude code vs claude agent sdk, and in that regard that combined with a local sandboxing for the react native app makes sense.

  2. mavdol commented on Feb 24, 2026

    @mavdol
    Author

    Thanks @bidah ! Oh i see, yeah it could fit really well. Let me know if you ever need help implementing it or resources for your coding agent.

  3. bidah commented on Mar 12, 2026

    @bidah
    Collaborator

    go with a PR, we can test it

  4. mavdol commented on Mar 13, 2026

    @mavdol
    Author

    Hi! I just took a closer look at the codebase, and I realize I may have misunderstood the "E2B and Daytona SDK for secure code execution" line in the readme. I thought we were looking for a local alternative code interpreter sandbox.

    The solution I built is more designed for stateless, isolated task execution like running individual Python/JavaScript code or other specific sandboxed tasks. From what I see, we probably need a full stateful environment (like Docker) for react native vibe code sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions