# Examples Complete, tested programs with output, cost and cleanup. ## Before you start 1. Run `fdtn auth` or set `FDTN_API_KEY`. [Quickstart](https://fdtn.dev/docs/quickstart.md) 2. Install the SDK: `pip install https://compute.fdtn.dev/install/fdtn-0.1.5-py3-none-any.whl` or `npm i https://compute.fdtn.dev/install/fdtn-sdk-0.1.5.tgz`. 3. Save the code in a new folder. TypeScript files are ESM (`.mjs`). For a coding agent, add `.md` to the page address, for example `https://fdtn.dev/docs/examples/preview.md`. ## AI agents - [**Run code from an LLM**: Run untrusted code with a time limit and read the result.](https://fdtn.dev/docs/examples/code-interpreter.md) - [**Give an agent a code tool**: A tool-use loop with a run_code tool backed by a sandbox.](https://fdtn.dev/docs/examples/agent-tool.md) - [**Test a change to a repo**: Run the tests, apply a change, test again and get the diff.](https://fdtn.dev/docs/examples/repo-agent.md) - [**Run an AI engineer**: Give an AI agent its own computer that pauses between tasks, with your key.](https://fdtn.dev/docs/examples/ai-engineer.md) - [**Run Claude Code from code**: Give Claude Code one task in a sandbox and read the result.](https://fdtn.dev/docs/coding-agents.md#from-code) ## Work at scale - [**Split a test suite**: Run test shards in many sandboxes and collect the reports.](https://fdtn.dev/docs/examples/test-shards.md) - [**Grade evals in parallel**: Grade model answers in many sandboxes at the same time.](https://fdtn.dev/docs/examples/evals.md) - [**Run a headless browser**: Build a Playwright template and screenshot a JavaScript page.](https://fdtn.dev/docs/examples/browser.md) ## Data and apps - [**Analyze a CSV file**: Upload a data file, run pandas and download the chart.](https://fdtn.dev/docs/examples/data-analysis.md) - [**Preview a web app**: Start a server on a public port and share its URL with people.](https://fdtn.dev/docs/examples/preview.md) - [**Pause a worker**: Pause an idle sandbox with its memory and resume it later.](https://fdtn.dev/docs/examples/background-worker.md) - [**Receive webhooks**: A webhook receiver that checks signatures and drops duplicates.](https://fdtn.dev/docs/examples/webhook-receiver.md) ## Rules in every example - Each sandbox has a lifetime, so it ends even if your code stops early. - Code kills each sandbox in `finally`. Scripts end with `fdtn kill`. - Metadata on each sandbox lets `fdtn ls -m` and `fdtn kill --all -m` find leftovers. - Costs use $0.018 per vCPU-hour and $0.006 per GiB-hour. `base` costs $0.039 per hour. [Pricing](https://fdtn.dev/docs/pricing.md) Source: https://fdtn.dev/docs/examples/