eavz

Code & Sandbox

Run custom JavaScript, Python, and Shell code in secure sandbox environments.

Code & Sandbox

Weavz includes built-in code execution integrations — from lightweight data transforms to full multi-language sandbox environments. Use them to run custom logic, process data between integration calls, or build complex multi-step workflows.

Code Integration

A lightweight, secure JavaScript sandbox for data transformation and processing. Zero setup required — works out of the box.

  • Action: run_code
  • Input: JavaScript code + optional inputs JSON object
  • Output: Return value + captured console logs
  • No network access, no filesystem, no imports — pure computation only

Use Cases

  • Data transformation between API calls
  • Text parsing and formatting
  • JSON reshaping and filtering
  • Calculations and aggregations

Example: Transform API data

bash
curl -X POST https://api.weavz.io/api/v1/actions/execute \
  -H "Authorization: Bearer wvz_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationName": "code",
    "actionName": "run_code",
    "workspaceId": "proj_abc123",
    "input": {
      "code": "const data = inputs.rows.map(row => ({ name: row[0], email: row[1], score: parseInt(row[2]) })); return data.filter(d => d.score > 80);",
      "inputs": { "rows": [["Alice", "[email protected]", "90"], ["Bob", "[email protected]", "70"]] }
    }
  }'

Advanced Code Integration

A full multi-language sandbox environment with persistent state and network access.

  • Languages: JavaScript, Python, Shell
  • Network access: fetch, HTTP libraries, external APIs
  • Filesystem: /tmp and /workspace directories
  • Persistent sandbox: Keep installed packages and state across executions
  • Persistent storage: Mounted at /persistent-storage
  • Timeout: Up to 60 seconds per execution
  • Storage scoping: End-user-bound (when endUserId provided), workspace-bound, or external-ID-bound via custom ID. Persistent sandbox containers are also per-user when end-user scoped.

Example: Python data processing

bash
curl -X POST https://api.weavz.io/api/v1/actions/execute \
  -H "Authorization: Bearer wvz_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationName": "advanced-code",
    "actionName": "run_code",
    "workspaceId": "proj_abc123",
    "input": {
      "language": "python",
      "code": "import json\ndata = json.loads(inputs[\"raw\"])\nresult = sum(d[\"amount\"] for d in data)\nprint(f\"Total: {result}\")",
      "persistSandbox": true
    }
  }'

Example: Shell scripting

bash
curl -X POST https://api.weavz.io/api/v1/actions/execute \
  -H "Authorization: Bearer wvz_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationName": "advanced-code",
    "actionName": "run_code",
    "workspaceId": "proj_abc123",
    "input": {
      "language": "shell",
      "code": "echo \"Files in workspace:\"\nls -la /workspace\necho \"Done\""
    }
  }'

When to Use Which

FeatureCodeAdvanced CodeMCP Code Mode
LanguagesJavaScript onlyJS, Python, ShellJavaScript only
Network accessNoYesYes (via weavz.*)
Access to integrationsNoNoYes (full weavz.* namespace)
Persistent stateNoYes (optional)No
Persistent storageNoYesNo
Best forData transformsComplex processingAI agent workflows
SetupZeroAvailable on supported plansMCP server in CODE mode

Next Steps