# WebAssembly jobs

Short, deterministic tasks compiled to WebAssembly (WASI preview 1) can run without starting a virtual machine: `"runtime": "wasi"`. They start fast and cost less, but have **no network**.

## Run a module

**Python**

```
from wbxsandbox import run_job, job_input

job = run_job(wasm_module=open("tool.wasm", "rb").read(), wasm_args=["--fast"], wasm_memory_mb=128,
              inputs=[job_input("JOB_ID", "output/data.csv")], save_artifacts=True)
print(job.wait().summary())
```

**curl**

```
curl -s -X POST https://sandbox.wbx.cz/v1/jobs -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"runtime": "wasi", "timeout_s": 60, "artifacts": ["output/"],
       "wasm": {"module_b64": "'"$(base64 -w0 tool.wasm)"'", "args": ["--fast"], "memory_mb": 128},
       "inputs": [{"job_id": "JOB_ID", "name": "output/data.csv"}]}'
```

## What the module sees

- Only `/input` (read-only, the job's [inputs](https://sandbox.wbx.cz/docs/jobs/inputs.md)), `/output` and `/tmp`. Files written to `/output` become result files named `output/…`.
- Clocks and random numbers inside the module are deterministic.
- No network.

## Limits and price

- Module up to 8 MB inline (up to 32 MB as an input named in `wasm.module`), memory 16–1024 MB, time up to 10 minutes, stdin up to 4 MB, 64 output files (64 MB together).
- Price: measured run time × (1 vCPU + the memory limit) at your plan's rates.

> **Weaker isolation.** The isolation is a sandboxed process, which is weaker than a virtual machine – use the default runtime for anything that needs a full Linux system. `GET /v1/runtimes` lists runtimes with their isolation level and capabilities.

Source: https://sandbox.wbx.cz/docs/jobs/wasm
