# Quickstart Start an isolated Linux sandbox and run a command in it, from the terminal and from code. It takes about 5 minutes. **Using an AI coding agent?** Paste this into Claude Code, Cursor or another agent. It reads our docs and asks you before it runs anything. ``` I want to use Foundational Compute (https://fdtn.dev) to run code in cloud sandboxes. Read https://fdtn.dev/llms.txt first, and follow only what it says. Explain each command before you run it, and ask me before you install anything. I will sign in myself with fdtn auth. Never ask me to paste my API key into this chat. ``` ## 1. Create an API key 1. Sign in at [compute.fdtn.dev](https://compute.fdtn.dev) with Google or GitHub. The first sign-in creates your personal workspace. 2. Open **API keys** and create a key. It starts with `fdtn_`. 3. Copy it. The page shows it only once. Do not paste it into a chat or a project file. A personal workspace starts with a $20 welcome credit, with no card. [Credit](https://fdtn.dev/docs/limits.md#free) ## 2. Install the CLI The `fdtn` command needs Node.js 22.19 or newer and npm ([nodejs.org](https://nodejs.org)). Do not type the `$`. macOS: ```bash $ curl -fsSL https://compute.fdtn.dev/install | sh ``` Linux: ```bash $ curl -fsSL https://compute.fdtn.dev/install | sh ``` Windows: ```powershell # The install line needs sh. Run it in WSL: $ curl -fsSL https://compute.fdtn.dev/install | sh # Or skip the CLI and set the key for the SDKs (then open a new terminal): > setx FDTN_API_KEY fdtn_... ``` The script checks the sha256 checksum and installs with `npm i -g`. It does not touch your API key. [Install errors](https://fdtn.dev/docs/troubleshooting.md#install) ## 3. Sign in and test ```bash $ fdtn auth Paste your API key from https://compute.fdtn.dev, then press Return: Key saved. You are signed in. ``` The key goes to `~/.fdtn/key`, readable only by you. The CLI and SDKs read it there. On a server or in CI, set `FDTN_API_KEY`; it wins over the file. [API keys](https://fdtn.dev/docs/keys.md) Test the setup. This starts a small sandbox, runs a command and stops it: ```bash $ fdtn doctor --create ✓ api key: from key file, starts with fdtn_, 45 characters ✓ dns: api.sbx.fdtn.dev -> 203.0.113.10 ✓ tls: certificate for api.sbx.fdtn.dev accepted ✓ key accepted: listed your sandboxes ✓ sandbox round trip: i... started in 111 ms, ran a command, stopped ``` A failed check starts with `✗` and has a `fix:` line under it. [fdtn doctor results](https://fdtn.dev/docs/troubleshooting.md#doctor) ## 4. Start a sandbox A sandbox is a separate Linux computer. A template is the system it starts from; `base` is the default. ```bash $ fdtn create base Starting a sandbox from template base... Terminal connecting to template base with sandbox ID i... user@fdtn:~$ ``` You get a terminal inside the sandbox. Type `exit` to leave; the sandbox then stops. | Size | 2 vCPU, 512 MiB, 5 GiB disk: $0.039 an hour. [Pricing](https://fdtn.dev/docs/pricing.md) | |---|---| | Installed | Debian 12, Python 3.11, pip, Node.js 20, git, curl | | Lifetime | 5 minutes by default, up to 24 hours | | Start | Under 500 ms | | CPU | arm64 | ## 5. Control it from your terminal ```bash $ fdtn create base -d --name worker # start only, print the id $ fdtn exec @worker echo hello # run a command, get its output and exit code $ fdtn connect @worker # open a terminal inside $ fdtn cp -r @worker:/tmp ./out # download files $ fdtn ls # list your running sandboxes $ fdtn pause @worker # keep memory and files, stop the clock $ fdtn resume @worker # bring it back $ fdtn kill @worker # stop it for good ``` - `-d` starts without a terminal. The sandbox stops after 5 minutes, or after `--timeout `. - Each command that uses the sandbox sets its time left to at least 5 minutes. - `@name` replaces the ID. A new name can take a few seconds to resolve. ## 6. Use it from code Python needs 3.11 or newer; install into a virtual environment (`python3 -m venv .venv && . .venv/bin/activate`). TypeScript needs Node.js 22.19 or newer. The SDKs do not need the `fdtn` command: set `FDTN_API_KEY`. 1. Install the SDK: Python: ```python $ pip install https://compute.fdtn.dev/install/fdtn-0.1.5-py3-none-any.whl ``` TypeScript: ```typescript $ npm i https://compute.fdtn.dev/install/fdtn-sdk-0.1.5.tgz ``` 2. Save this file and run `python hello.py` or `node hello.mjs` (the TypeScript SDK is ESM). It prints `hello`. Python (hello.py): ```python from fdtn import Sandbox # timeout: how long the sandbox lives, in seconds. # request_timeout: how long the SDK waits for the start, in seconds. sbx = Sandbox.create("base", timeout=300, request_timeout=120) try: result = sbx.commands.run("echo hello") print(result.stdout) finally: sbx.kill() ``` TypeScript (hello.mjs): ```typescript import { Sandbox } from '@fdtn/sdk' // timeoutMs: how long the sandbox lives. requestTimeoutMs: how long the SDK waits for the start. const sbx = await Sandbox.create('base', { timeoutMs: 300_000, requestTimeoutMs: 120_000 }) try { const result = await sbx.commands.run('echo hello') console.log(result.stdout) } finally { await sbx.kill() } ``` The SDK waits 60 seconds for a start by default. A create can wait up to 30 minutes in the queue; for batches, set `request_timeout=1800` or `requestTimeoutMs: 1_800_000`. [The queue](https://fdtn.dev/docs/limits.md#queue) ## Next - [**Concepts**: Templates, sizes and lifetime.](https://fdtn.dev/docs/concepts.md) - [**Reference at a glance**: Every default and hard limit.](https://fdtn.dev/docs/reference.md) - [**Coding agents**: Run Claude Code in a sandbox.](https://fdtn.dev/docs/coding-agents.md) - [**CLI**: The main commands and their options.](https://fdtn.dev/docs/cli.md) - [**Python SDK**: Every Python class and method.](https://fdtn.dev/docs/python.md) - [**TypeScript SDK**: The same API for Node.js.](https://fdtn.dev/docs/typescript.md) Source: https://fdtn.dev/docs/