> ## 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.

# Quickstart

> Install an SDK, create a sandbox, run code.

<Tabs>
  <Tab title="Python">
    ```bash theme={null}
    pip install podflare
    ```

    ```python theme={null}
    from podflare import Sandbox

    with Sandbox() as s:
        r = s.run_code("print(sum(range(10)))")
        print(r.stdout)  # 45
    ```
  </Tab>

  <Tab title="TypeScript">
    ```bash theme={null}
    npm install podflare
    ```

    ```ts theme={null}
    import { Sandbox } from "podflare";

    const s = await Sandbox.create();
    try {
      const r = await s.runCode("print(sum(range(10)))");
      console.log(r.stdout); // 45
    } finally {
      await s.close();
    }
    ```
  </Tab>

  <Tab title="curl">
    ```bash theme={null}
    # 1. create
    SID=$(curl -s -X POST https://api.podflare.ai/v1/sandboxes \
      -H 'content-type: application/json' -d '{}' | jq -r .id)

    # 2. exec (streams NDJSON events)
    curl -s -X POST https://api.podflare.ai/v1/sandboxes/$SID/exec \
      -H 'content-type: application/json' \
      -d '{"code": "print(sum(range(10)))"}'

    # 3. destroy
    curl -s -X DELETE https://api.podflare.ai/v1/sandboxes/$SID
    ```
  </Tab>
</Tabs>

## Configuration

<ParamField path="PODFLARE_HOSTD_URL" type="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.
</ParamField>

## 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.

```python theme={null}
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
```

## Fork for tree-search

<Tip>
  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.
</Tip>

```python theme={null}
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

<CardGroup cols={2}>
  <Card title="Concepts: fork" icon="code-branch" href="/concepts/fork">
    How CoW branching + REPL inheritance actually works
  </Card>

  <Card title="API Reference" icon="square-terminal" href="/api-reference/introduction">
    The full HTTP surface
  </Card>
</CardGroup>
