Skip to content

Synapse-Run/cell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Synapse Cell
Receipted Wasm execution for bounded AI-generated logic.
151.8× lower p50 latency than E2B on the latest AX102 simple eval run. Cryptographic receipts. Self-hosted. Canadian-built.

Docs PyPI npm CI License: AGPL-3.0


What is Synapse Cell?

Cell is a WebAssembly-native sandbox for executing bounded AI agent tool calls: eval functions, policy gates, reward functions, and small generated logic. While Firecracker-based sandboxes give agents a full Linux computer, Cell focuses on fast Wasm execution with a receipt you can verify after the fact.

Why it exists: Canadian AI builders and automation teams need a way to show clients what an agent executed. Cell returns a SHA-256 receipt for every execution so you can recompute whether the returned fields were modified.

pip install "synapserun[local]"
synapse doctor

Quick Start

Installed proof path:

pip install "synapserun[local]"
synapse doctor
synapse demo assurance

synapse doctor checks that the installed native local backend is current enough to return receipt-bearing execution results. The demo then runs a bounded policy gate locally, verifies the receipt, rejects a tampered receipt, and replays the receipt bundle.

from synapse.cell import Cell

cell = Cell(api_url="local")
result = cell.run("print(2 + 2)")
print(result.stdout)       # '4\n'
print(result.latency_ms)   # ~1-2ms on the AX102 fast path
print(result.receipt)       # CellReceipt(receipt_hash='a4f2...')
print(result.receipt.verify())
cell.kill()

Zero configuration. No Docker. No API key. The Wasm runtimes ship inside the wheel.

E2B-Style Python Migration

# Before:
# from e2b_code_interpreter import Sandbox

# After:
from synapse.e2b_compat import Sandbox

sbx = Sandbox(api_url="local")
result = sbx.run_code("print('hello')")
print(result.stdout)  # 'hello\n'

Performance

Measured head-to-head against live E2B API. Rerun the benchmark before using the number in a launch or sales claim.

Workload Cell p50 Cell p99 E2B p50 Speedup (p50)
Simple eval (print, arithmetic) 1.334ms 7.7317ms 202.559ms 151.8×
Math heavy (10K loop sum) 1.1873ms 55.3216ms 196.8904ms 165.8×
File I/O (100KB write/read, deep probe) 68.5863ms 130.7224ms 197.5103ms 2.9×
Memory per sandbox ~1 MB ~133 MB Separate density claim

Methodology: 100 runs, 10 warmup discarded, --sandbox-timeout-secs 3600. Latest canonical live E2B comparison: 2026-05-15 on AX102 at commit b9e6eb1f639599d1da02cbf00a035528c7886303. Cell via local release-mode PyO3 path; E2B via e2b-code-interpreter SDK Pro tier. See benchmarks/METHODOLOGY.md and benchmarks/PYTHON_COVERAGE_AUDIT_2026-05-15.md. Hardware: AMD Ryzen 9 7950X3D, Ubuntu 24.04. Reproducible: python3 benchmarks/e2b_apples_to_apples.py --runs 100 --warmup 10

Separate AX102 corpus evidence at commit 59c8dc7: 35/35 declared claim-candidate bounded policy/eval/validation/redaction/rubric/automation snippets stayed on the fast path with verified receipts and p95 under 5ms, including a moderate 4-worker CPU contention run. That is not a broad Python or persistent Linux workspace claim.

The speed advantage is structural. Wasm has no kernel to boot. Firecracker-based platforms are stronger when you need a full Linux workspace; Cell's advantage is the small Wasm fast path with receipts.

Features

Execution

  • Python 3.12 (CPython-WASI) — broad Python fallback with bundled stdlib modules
  • JavaScript (QuickJS-WASI) — ES2023, closures, typed arrays
  • Low-ms fast path — bounded arithmetic/string and JSON/list policy snippets transpile to .syn, skipping CPython entirely
  • Streamingcell.run(code, on_stdout=callback) with real-time SSE

Sandbox Management

  • Create / kill locally; pause / resume / snapshot on the HTTP gateway where configured
  • Persistent state is a gateway/Pro feature; do not treat local PyO3 as persistent Python parity
  • Volumes (persistent cross-sandbox storage)
  • Templates (custom sandbox configurations)
  • Metadata, env vars, timeout control

Developer Tools

  • Filesystemcell.files.read/write/list/exists/make_dir/rename/remove
  • Gitcell.git.clone/commit/push/pull/checkout/status (21 methods)
  • PTYcell.pty.create(on_data=...) for interactive terminals
  • CLIsynapse sandbox create, synapse sandbox run, synapse template build

AI Agent Integrations

pip install "synapserun[local,langchain]"     # LangChain tool + local runtime
pip install "synapserun[local,crewai]"        # CrewAI tool + local runtime
pip install "synapserun[local,openai-agents]" # OpenAI Agents SDK + local runtime
pip install "synapserun[local,autogen]"       # AutoGen executor + local runtime
pip install "synapserun[local,llamaindex]"    # LlamaIndex tool + local runtime
pip install "synapserun[local,all]"           # Everything + local runtime

Receipts & Security

  • SHA-256 receipt chain — every execution produces a cryptographic receipt
  • Receipt verifier helpers — Python result.receipt.verify() / verify(require_signature=True) (synapserun[crypto]) and TypeScript verifyReceipt(receipt)
  • Receipt bundles and replaysynapse receipt create|inspect|verify|replay creates portable audit artifacts for bounded executions
  • Evidence packetssynapse evidence report <bundle.json> --out evidence.html writes self-contained reviewer reports without exposing full code/output bodies
  • AGPL + Apache 2.0 — inspect every line, self-host forever
  • Self-hosted jurisdiction control — run on infrastructure you choose
  • Audit-oriented — useful evidence for governed AI workflows; not a blanket compliance certification

Assurance Pack

The first product package is for Canadian AI builders: agencies, automation consultants, applied-AI startups, and internal innovation teams that need safer agent workflows for regulated or IP-sensitive clients.

Deployment Modes

Mode Command When
Local Cell(api_url="local") Development, CI, edge, embedded
Self-hosted docker run ghcr.io/synapse-run/cell Production, fleet management
Managed Cell(api_key="sk_...") Coming soon

Architecture

AI Agent → tool call → Synapse SDK → Wasm sandbox → result + receipt
                                         │
                                    No kernel boot
                                    No container
                                    Prewarmed local create p50: 0.42ms
                                    Fresh-process cold total p50: 144ms
                                    Fast exec p50: ~1-2ms

Cell uses wasmtime to execute sandboxed code. The gateway is a 12,000-line Rust binary that manages sandbox lifecycle, handles HTTP/WebSocket APIs, and produces cryptographic receipts.

Self-Hosting

# Option 1: Docker
export SYNAPSE_API_KEY="change-me"
export CELL_API_KEY="$SYNAPSE_API_KEY"
docker run -p 8002:8002 \
  -e SYNAPSE_API_KEY \
  -e CELL_API_KEY \
  ghcr.io/synapse-run/cell

# Option 2: Build from source
cd gateway && cargo build --release --bin synapse-gateway --no-default-features
SYNAPSE_API_KEY="change-me" CELL_API_KEY="change-me" SYNAPSE_CELL_ONLY=1 ./target/release/synapse-gateway
curl http://localhost:8002/v1/health
# {"status":"ok","service":"cell","version":"0.2.1rc1"}
SYNAPSE_API_KEY="$CELL_API_KEY" synapse demo assurance --api-url http://localhost:8002

For the full container proof path, run scripts/self_host_gateway_smoke.sh or follow docs/self-hosted-assurance-runbook.md.

API Reference

Full OpenAPI 3.1 spec: gateway/openapi.yaml (27 endpoints)

Key endpoints:

  • POST /v1/cells — Create a sandbox
  • POST /v1/cells/{id}/exec — Execute code
  • GET /v1/cells/{id}/files/list — List files
  • POST /v1/cells/{id}/exec/stream — SSE streaming execution
  • POST /v1/cells/{id}/pause / resume — Lifecycle management
  • GET /v1/health — Health check

Project Structure

cell/
├── gateway/          # Rust gateway (12K LOC)
│   ├── src/
│   │   ├── main.rs         # HTTP server, WebSocket, rate limiter
│   │   ├── cell.rs         # Sandbox lifecycle, Wasm execution
│   │   ├── cell_api.rs     # REST API routes
│   │   ├── compiler.rs     # .syn compiler
│   │   ├── transpiler.rs   # Python → .syn transpiler
│   │   └── ...
│   ├── openapi.yaml        # API spec
│   └── Cargo.toml
├── sdk/              # Python + JS SDKs
│   ├── synapse/            # Python SDK (9.6K LOC, 22 modules)
│   ├── js/                 # TypeScript SDK
│   ├── tests/              # Test suite
│   └── pyproject.toml
├── benchmarks/       # Reproducible benchmarks
├── templates/        # Sandbox templates
└── docs/             # Documentation

Contributing

See CONTRIBUTING.md. We use conventional commits (feat:, fix:, docs:, tests:, bench:).

License

  • Gateway + SDK: AGPL-3.0 — use freely, contribute changes back
  • Commercial License: Available for closed-source deployments
  • Wasm Runtimes: Apache 2.0 (wasmtime)

Links

The npm scope @runsynapse/sdk was published before the synapserun.dev brand was canonicalized; a migration to @synapserun/sdk is planned for a future major release. The current package remains supported and active.


Built by Synapse Run, Canada 🇨🇦
Wasm-native. Sovereign. Self-hosted.

About

Wasm-native code execution sandbox for AI agents. 138-152x faster than E2B at p50. SHA-256 cryptographic receipts. Self-hosted. AGPL-3.0 + Apache-2.0 + Commercial dual license.

Topics

Resources

License

Apache-2.0, AGPL-3.0 licenses found

Licenses found

Apache-2.0
LICENSE
AGPL-3.0
LICENSE-AGPL.md

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors