Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.podflare.ai/llms.txt

Use this file to discover all available pages before exploring further.

pip install podflare
from podflare import Sandbox

with Sandbox() as s:
    r = s.run_code("print(sum(range(10)))")
    print(r.stdout)  # 45

Configuration

PODFLARE_HOSTD_URL
string
default:"https://api.podflare.ai"
Base URL of the hostd HTTP API. In hosted mode this is set to the cloud endpoint; during local dev it’s the Hetzner box you tunneled to.

Run Python with persistent state

Each sandbox owns a long-lived Python process. Variables, imports, and any in-memory state survive across run_code calls.
with Sandbox() as s:
    s.run_code("import pandas as pd")
    s.run_code("df = pd.read_csv('/data/customers.csv')")
    s.run_code("print(df.shape)")  # pandas + df are both in scope
This is the reason you chose Podflare. Set up expensive state once, then fork N ways. Each child inherits the parent’s Python REPL + filesystem — subsequent divergence is copy-on-write isolated.
with Sandbox() as parent:
    parent.run_code("import json; cfg = {'temp': 0.7}")

    children = parent.fork(n=3)
    try:
        for c in children:
            print(c.run_code("print(json.dumps(cfg))").stdout)
    finally:
        for c in children:
            c.close()

Next

Concepts: fork

How CoW branching + REPL inheritance actually works

API Reference

The full HTTP surface