---
title: "Cookbook"
description: "Every MIOSA recipe in one place, grouped by area. Sandbox procedures and platform-builder walkthroughs, each with a working code path."
last_updated: 2026-10-11
url: https://miosa.ai/docs/cookbook
---

# Cookbook

Practical walkthroughs for the things customers build on MIOSA. Each recipe starts with a product goal and ends with a running result, and every one is grounded in the current SDK and API.

The recipes live next to the product they belong to in the sidebar, under **Sandboxes > Recipes** and **Platform builders > Recipes**. This page is the index of all of them.

## Sandbox recipes

For running code, agents, and browsers inside a sandbox.

- [Agent builds an app](https://miosa.ai/docs/cookbook/agent-builds-app.md): The full lifecycle: user prompt to files, dev server, live preview, feedback loop, publish, and a stable production URL.
- [Agent with secrets](https://miosa.ai/docs/cookbook/agent-with-secrets.md): Inject API keys and OAuth credentials into a sandbox without exposing them in code, logs, or the browser.
- [Streaming code execution](https://miosa.ai/docs/cookbook/streaming-code-execution.md): Run code and stream stdout to your UI in real time: graders, workflow builders, data jobs, and AI tool execution.
- [Browser agent](https://miosa.ai/docs/cookbook/browser-agent.md): Drive the sandbox browser with an LLM over CDP: screenshot, decide, act, and watch the same session live.

## Platform builder recipes

For embedding MIOSA into your own product and charging your customers for it.

- [Multi-tenant SaaS](https://miosa.ai/docs/cookbook/multi-tenant-saas.md): Tag every sandbox with your own workspace and user IDs, query usage per tenant, and hand the browser a short-lived preview share token.
- [Per-user quotas and billing](https://miosa.ai/docs/cookbook/per-user-quotas-billing.md): Cap end-users with max_sandboxes and credit limits, pull monthly rollups keyed by external_user_id, and wire the totals into Stripe.
- [Embed a sandbox in an iframe](https://miosa.ai/docs/cookbook/embed-sandbox-iframe.md): Your server mints a preview token; your frontend drops it into an iframe. React, Vue, Svelte, and vanilla variants, with TTL refresh.
- [Realtime sandbox events](https://miosa.ai/docs/cookbook/sandbox-events-realtime.md): React to sandbox lifecycle events through HMAC-signed webhooks or the SSE stream, with idempotency patterns.
- [Build a virtual device product](https://miosa.ai/docs/cookbook/build-virtual-device-product.md): A product blueprint for exposing a device per user: MIOSA mapping, architecture, data model, and jobs.

## Before you start

All recipes share the same prerequisites:

- A MIOSA workspace API key (`msk_u_*`)  -  see [API Keys](https://miosa.ai/docs/platform/api-keys.md)
- Node 22+ **or** Python 3.11+ installed locally
- The MIOSA SDK installed for your language:

```bash
# Python
pip install miosa

# TypeScript / Node
npm install @miosa/sdk
```

Set the key in your environment once  -  every recipe reads it from there:

```bash
export MIOSA_API_KEY="msk_u_..."
```
