Cookbook
Practical walkthroughs for the things customers actually build on MIOSA. Each recipe starts with a product goal, then shows the sandbox, preview, deployment, domain, token, and attribution pieces involved.
Agent and app building
Full lifecycle: user prompt → agent writes files → dev server → live preview → feedback loop → publish → stable production URL.
Run code and stream stdout to your UI in real time. Useful for graders, workflow builders, data jobs, and AI tool execution.
Use a Computer when the task needs a real browser: screenshots, clicks, forms, login flows, and human takeover.
Multi-tenant and SaaS
Example product flow: a clinic asks for a campaign, the agent builds a landing page, previews it on the platform domain, and publishes to a durable app URL.
Full-stack flow: generated server app, managed data intent, dynamic runtime, health check, and final deployment URL returned by the API.
Embed a live sandbox preview in your product while the app is still changing. Your backend mints the browser-safe token.
Tag every sandbox with your own workspace and user IDs. Query usage per tenant. Issue browser tokens. Set per-user quotas. Pull the audit log.
Cap end-users with max_sandboxes and credit limits. Pull monthly usage rollups keyed by external_user_id. Wire into Stripe for automated invoicing.
Completely rebrand the sandbox experience with your own domain, logo, and colors. End users never see MIOSA.
Embedding and real-time
Server mints a preview token; frontend drops it into an iframe. React, Vue, Svelte, and vanilla JS variants. Covers token TTL refresh.
React to sandbox lifecycle events via HMAC-signed webhooks (durable, server-to-server) or the SSE stream (in-process). Idempotency patterns included.
Resilience and safety
Checkpoint a long-running task with snapshots. Fork into parallel branches for A/B experiments. Restore to a known-good state on failure.
Inject API keys and credentials into sandboxes without exposing them in code or logs.
Restrict what code running inside a sandbox can reach - egress allowlists, network policies, and audit logging.
Before you start
All recipes share the same prerequisites:
- A MIOSA workspace API key (
msk_live_*) - see API Keys - Node 22+ or Python 3.11+ installed locally
- The MIOSA SDK installed for your language:
# Python
pip install miosa
# TypeScript / Node
npm install @miosa/sdk Set the key in your environment once - every recipe reads it from there:
export MIOSA_API_KEY="msk_live_..."