curl -X POST https://api.podflare.ai/v1/sandboxes/$SID/fork \
-H 'content-type: application/json' \
-d '{"n": 5}'
children = parent.fork(n=5)
try:
results = [c.run_code(plan) for c, plan in zip(children, plans)]
finally:
for c in children:
c.close()
const children = await parent.fork(5);
try {
const results = await Promise.all(
children.map((c, i) => c.runCode(plans[i]))
);
} finally {
for (const c of children) await c.close();
}
{
"children": [
"sbx_a1ac8f28d473413585d8f4f425bcc2b1",
"sbx_03cfbf63bb394575aefa4e6c62874998",
"sbx_532288c716c8424cb8bb549e6ce2748b",
"sbx_bca65926af5f4afcaa6b8f20a66845b2",
"sbx_267b68883b41469fbda8973296767542"
]
}
Reference
Fork
Snapshot a running sandbox and spawn N copies from that state.
POST
/
v1
/
sandboxes
/
{id}
/
fork
curl -X POST https://api.podflare.ai/v1/sandboxes/$SID/fork \
-H 'content-type: application/json' \
-d '{"n": 5}'
children = parent.fork(n=5)
try:
results = [c.run_code(plan) for c, plan in zip(children, plans)]
finally:
for c in children:
c.close()
const children = await parent.fork(5);
try {
const results = await Promise.all(
children.map((c, i) => c.runCode(plans[i]))
);
} finally {
for (const c of children) await c.close();
}
{
"children": [
"sbx_a1ac8f28d473413585d8f4f425bcc2b1",
"sbx_03cfbf63bb394575aefa4e6c62874998",
"sbx_532288c716c8424cb8bb549e6ce2748b",
"sbx_bca65926af5f4afcaa6b8f20a66845b2",
"sbx_267b68883b41469fbda8973296767542"
]
}
string
required
Parent sandbox id.
int
default:"1"
Number of children to spawn. Range 1..=32.
curl -X POST https://api.podflare.ai/v1/sandboxes/$SID/fork \
-H 'content-type: application/json' \
-d '{"n": 5}'
children = parent.fork(n=5)
try:
results = [c.run_code(plan) for c, plan in zip(children, plans)]
finally:
for c in children:
c.close()
const children = await parent.fork(5);
try {
const results = await Promise.all(
children.map((c, i) => c.runCode(plans[i]))
);
} finally {
for (const c of children) await c.close();
}
{
"children": [
"sbx_a1ac8f28d473413585d8f4f425bcc2b1",
"sbx_03cfbf63bb394575aefa4e6c62874998",
"sbx_532288c716c8424cb8bb549e6ce2748b",
"sbx_bca65926af5f4afcaa6b8f20a66845b2",
"sbx_267b68883b41469fbda8973296767542"
]
}
What children inherit
Each child starts from the parent’s state at the moment of snapshot:- Python REPL state — variables, imports, open files.
- Filesystem — everything written to the parent’s rootfs so far.
- Full VM memory — page-level CoW shared with siblings; divergence only costs the pages a child mutates.
Parent impact
- Paused for ~80 ms during snapshot. Resume is automatic.
execcalls on the parent made afterforkreturns are NOT visible in children. Each child only sees pre-fork state.
Timing (Hetzner EX63)
| n | Total fork latency |
|---|---|
| 1 | 92 ms |
| 2 | 102 ms |
| 5 | 101 ms |
Requirements
Parent must be a pool-warm sandbox (or itself a fork child). Sandboxes
created with custom RAM / rootfs skip the warm pool and cannot be
forked — fork will return 500 on those.

