Code Execution
Stacknet supports sandboxed code execution — models can write and run code in isolated containers operated by aISP nodes. This enables data analysis, computation, file generation, and tool building directly within conversations.
How it works
Sandbox security
Every code execution runs in a hardened container:
| Control | Setting |
|---|---|
| Runtime | gvisor or kata containers |
| Network | --network none (no internet) |
| Capabilities | --cap-drop ALL (minimal privileges) |
| Memory | 4GB limit |
| CPU | 4 cores |
| Timeout | 600 seconds |
| Filesystem | Ephemeral (destroyed after execution) |
Deterministic attestation
Each execution produces a verifiable attestation:
attestation = SHA-256(
imageDigest +
inputHash +
outputHash +
exitCode +
environmentHash
)Warm pools
aISP nodes maintain warm pools of pre-started containers for sub-second execution startup:
Cold start: ~2-5 seconds (container creation)
Warm start: <100ms (pre-warmed container)Operators who maintain warm pools receive:
- Paperwork bonus on execution tasks
- Priority routing for sandbox-capable tasks
- Reputation boost for consistent availability
Usage
Automatic
Models with code execution capability will automatically write and run code when appropriate:
const response = await client.chat.completions.create({
model: 'preview',
messages: [
{ role: 'user', content: 'Generate a chart of Bitcoin prices for the last 30 days' }
],
tools: [{ type: 'code_execution' }],
})Last updated on