Build a coding-agent product

~25 min TypeScript Python

What you’re building: Wrap a harness in your own branded product.

Primitives you’ll use: Sandbox, Agent and harness, Deployment (App Engine)

Agent prompt

Start with your coding agent

Choose what you are building. The brief names the product it is modelled on, maps it onto MIOSA, and lists the exact commands. Copy it into OSA, Claude Code, Codex, or Cursor.

Template coming soon

1 What are you building?

Leave it empty and your agent will propose 3 names, pick one, and use it for resources, the domain and branding.

3 Configure

Harness
Model
Scale
Extras

4 Your prompt

Reference product

A branded coding-agent product, by You (built on an open harness) (/docs/build/run-agents): your own product that wraps a coding harness (Claude Code, Codex, OSA, Hermes or your own) in your UI and billing.

How it works: Your product accepts a task from a customer, runs a harness inside an isolated MIOSA machine for that customer, streams progress to your UI and bills for usage.

Key capabilities:

Customers submit coding tasks in your UI

A harness runs each task in isolation

Live progress and a reviewable result

Your branding and billing

Build an app LIKE A branded coding-agent product. It is not affiliated with You (built on an open harness): do not copy its name, branding or assets. Open /docs/build/run-agents first, confirm the capabilities above, and note anything this brief missed.

How it maps onto MIOSA

A workspace the agent can break safely -> a MIOSA sandbox per task, with the repo cloned into /workspace

The agent edits files and runs commands -> agent runs (`miosa prompt`, client.runs) streaming events on that sandbox (`miosa prompt --sandbox ... --harness ...`)

Parallel tasks -> one sandbox per task or branch, sandbox snapshots and fork to try a second approach

Results you can review -> `miosa run files`, `miosa run outputs`, and the git diff inside the sandbox

Your customers stay separate -> a workspace per customer, usage metered and billed through bill-to

Goal

Build an app like A branded coding-agent product on MIOSA, as a multi-tenant product sold to my customers. Each customer is isolated in its own workspace; I meter usage and bill them.

Product name: propose 3 product names, pick one, and use it for resource names, the domain and branding. Until you pick, <product-name> stands for it in the commands below.

Scale: a prototype.

Set up

npm i -g @miosa/cli

miosa login && miosa whoami

miosa api-key create <product-name>-key --preset agent

export MIOSA_API_KEY="msk_u_..."

miosa org

miosa connections add models # your own model provider key

Resources

Sandbox: the agent's isolated Linux workspace

miosa create <product-name>-task-1 --wait

Agents and harnesses: what a run can use

miosa agent harnesses

Deployment: a stable, versioned URL

miosa deploy create --from-sandbox <product-name>-ui --name <product-name> --wait

Data and storage

Keep a tasks table in your own datastore: task id, repo, branch, sandbox id, run id, status, result links, and the user or customer it belongs to. The code itself lives in the sandbox and in Git, not in your database.

Per-customer usage (runs, minutes) feeds your billing; read it with `miosa run usage --group-by model`.

Auth and tenancy

Your organization is the platform; customers never get a MIOSA account, they sign into YOUR product. One workspace per customer, created as they onboard, isolates their machines, runs and data.

miosa workspace create <product-name>-customer-1

Tag every machine and run with the customer id in `metadata`, and never query across customers. Meter usage per customer with GET /api/v1/usage and set who pays with PUT /api/v1/bill-to (/docs/platform/usage-and-billing).

Agent loop

Harness: OSA is MIOSA's own harness and works with any model provider you connect, including your own model.

Model: Anthropic (Claude). Calls use my own provider key (`miosa connections add models`); MIOSA platform keys are never used.

Sessions: one chat per project or conversation, so the agent keeps its context. The first `miosa prompt` on a sandbox uses `--new-chat` (a chat id is printed); every later turn passes `--chat <chat-id>`. `--reuse chat` keeps one new machine per chat so files persist.

Streaming: follow a run with `miosa run follow <run-id>` or client.runs.streamEvents(run.id), and steer or stop it with `miosa run steer` and `miosa run interrupt`.

The harness runs headless INSIDE the task sandbox with the repo checked out. It edits files, runs the project's own commands and commits; you never apply its edits from outside.

Parallel sessions are separate sandboxes (and separate chats). Snapshot before a risky change and fork to try a second approach.

Steps

1. Create one sandbox per task or branch so parallel tasks never share state.

miosa create <product-name>-task-1 --size medium --wait

Check: The sandbox is running; two tasks have two sandboxes.

2. Clone the repository and create the task branch. Pass the Git token per exec or through the Secrets API; do not store it in the sandbox `env`.

miosa exec <product-name>-task-1 -- git clone <repo-url> /workspace/repo

miosa exec <product-name>-task-1 --cwd /workspace/repo -- git checkout -b task/<task-id>

Check: The repo is in /workspace/repo on the task branch.

3. Dispatch the harness with the task.

miosa prompt --sandbox <product-name>-task-1 --harness osa --model <anthropic-model-id> --chat <chat-id> "Do the task; run the tests; commit your work"

Check: `miosa run list --status running` shows the run and events start streaming.

4. Follow the run, and steer or stop it from your UI.

miosa run follow <run-id>

miosa run steer --sandbox <product-name>-task-1 "also add tests"

miosa run interrupt --sandbox <product-name>-task-1

Check: The UI shows live events; a steer lands on the next turn; interrupt stops the agent.

5. Verify independently of the agent: run the test command yourself.

miosa exec <product-name>-task-1 --cwd /workspace/repo -- npm test

Check: Tests exit 0 in the sandbox, not just in the agent's summary.

6. Hand back the result: collect files and the diff, and push the branch if the task asks for it.

miosa run files <run-id>

miosa run download <run-id> <file-id> --output ./result

miosa exec <product-name>-task-1 --cwd /workspace/repo -- git push origin task/<task-id>

Check: The diff is reviewable outside the sandbox and the run id is attached to it.

7. Close out. For one-shot tasks let MIOSA do it (`miosa prompt --new-machine ... --after-run destroy`); keep or snapshot the sandbox when the user may continue.

Check: No orphaned sandboxes remain after the task is closed.

8. Ship your product UI (a normal web app: task form, live events, diff viewer) as a deployment, built in its own sandbox.

miosa create <product-name>-ui --template nextjs --wait

miosa deploy create --from-sandbox <product-name>-ui --name <product-name> --dir /workspace --port 3000 --run-command "npm start" --wait

Check: The public_url serves the task UI and submits a task end to end.

Limits and costs

Set `--max-time` on every run so a stuck agent cannot run forever; use `--notify-email` or a webhook for long tasks.

Give the agent a token scoped to one repository, and only the permissions the task needs.

Parallel tasks multiply cost: cap concurrency per user or customer.

Prototype: keep it to one machine at the default size, skip replicas and custom hostnames you do not need, and delete everything when you are done.

Acceptance checks

Two tasks run at the same time in two sandboxes without touching each other.

A finished task leaves a reviewable branch or diff and the run id.

Nothing was deployed or published: the deliverable is the diff.

Each customer is isolated in its own workspace and usage is metered against them.

Everything it created can be deleted with nothing left running.

What your choices added

  • Build a product. a workspace per customer, per-customer metering and bill-to
  • Agent suggests a name. proposes 3 product names and picks one; commands use <product-name>
  • Harness: OSA. dispatches with `miosa prompt --harness osa`
  • Model: Anthropic. your own provider key
  • Prototype. one small machine, no extras, easy to delete

What you're building

your own product that wraps a coding harness (Claude Code, Codex, OSA, Hermes or your own) in your UI and billing Modelled on A branded coding-agent product, by You (built on an open harness).

Your product accepts a task from a customer, runs a harness inside an isolated MIOSA machine for that customer, streams progress to your UI and bills for usage.

Primitives you'll use: Sandbox · Agent and harness · Deployment (App Engine)

  • Customers submit coding tasks in your UI
  • A harness runs each task in isolation
  • Live progress and a reviewable result
  • Your branding and billing

Source: /docs/build/run-agents. A branded coding-agent product is a trademark of You (built on an open harness); this guide is not affiliated with or endorsed by them.

What you need on MIOSA

Each row is one thing to create before you start. The number matches the step that uses it.

  1. Organization and API key Scopes every call; a workspace key is all a worker needs. miosa api-key create app-key --preset agent Docs
  2. Sandbox The isolated Linux workspace the agent writes code and runs commands in. miosa create app-box --template nextjs --wait Docs
  3. A workspace per customer Isolates each customer’s machines, deployments, and data as they onboard. miosa workspace create customer-1 Docs
  4. Branding and white-label Your name and slug on previews, deployments, and the desktop; customers never see MIOSA. miosa org Docs
  5. Usage metering and bill-to Usage per customer, and which account pays for new machines. miosa org bill Docs
  6. Agent and harness Turns a prompt into work: pick the harness and model a run uses. miosa agent harnesses Docs
  7. Deployment (App Engine) Publishes the app to an immutable, versioned URL with rollback. miosa deploy create --from-sandbox app-box --name app --wait Docs

Architecture

How it maps onto MIOSA

A workspace the agent can break safely -> a MIOSA sandbox per task, with the repo cloned into /workspace

The agent edits files and runs commands -> agent runs (`miosa prompt`, client.runs) streaming events on that sandbox (`miosa prompt --sandbox ... --harness ...`)

Parallel tasks -> one sandbox per task or branch, sandbox snapshots and fork to try a second approach

Results you can review -> `miosa run files`, `miosa run outputs`, and the git diff inside the sandbox

Your customers stay separate -> a workspace per customer, usage metered and billed through bill-to

Data and storage

Keep a tasks table in your own datastore: task id, repo, branch, sandbox id, run id, status, result links, and the user or customer it belongs to. The code itself lives in the sandbox and in Git, not in your database.

Per-customer usage (runs, minutes) feeds your billing; read it with `miosa run usage --group-by model`.

Auth and tenancy

Your organization is the platform; customers never get a MIOSA account, they sign into YOUR product. One workspace per customer, created as they onboard, isolates their machines, runs and data.

miosa workspace create coding-agent-product-customer-1

Tag every machine and run with the customer id in `metadata`, and never query across customers. Meter usage per customer with GET /api/v1/usage and set who pays with PUT /api/v1/bill-to (/docs/platform/usage-and-billing).

Agent loop

Harness: OSA is MIOSA's own harness and works with any model provider you connect, including your own model.

Model: Anthropic (Claude). Calls use my own provider key (`miosa connections add models`); MIOSA platform keys are never used.

Sessions: one chat per project or conversation, so the agent keeps its context. The first `miosa prompt` on a sandbox uses `--new-chat` (a chat id is printed); every later turn passes `--chat <chat-id>`. `--reuse chat` keeps one new machine per chat so files persist.

Streaming: follow a run with `miosa run follow <run-id>` or client.runs.streamEvents(run.id), and steer or stop it with `miosa run steer` and `miosa run interrupt`.

The harness runs headless INSIDE the task sandbox with the repo checked out. It edits files, runs the project's own commands and commits; you never apply its edits from outside.

Parallel sessions are separate sandboxes (and separate chats). Snapshot before a risky change and fork to try a second approach.

Steps

  1. Create one sandbox per task or branch so parallel tasks never share state.

    miosa create coding-agent-product-task-1 --size medium --wait

    Check: The sandbox is running; two tasks have two sandboxes.

  2. Clone the repository and create the task branch. Pass the Git token per exec or through the Secrets API; do not store it in the sandbox `env`.

    miosa exec coding-agent-product-task-1 -- git clone <repo-url> /workspace/repo
    miosa exec coding-agent-product-task-1 --cwd /workspace/repo -- git checkout -b task/<task-id>

    Check: The repo is in /workspace/repo on the task branch.

  3. Dispatch the harness with the task.

    miosa prompt --sandbox coding-agent-product-task-1 --harness osa --model <anthropic-model-id> --chat <chat-id> "Do the task; run the tests; commit your work"

    Check: `miosa run list --status running` shows the run and events start streaming.

  4. Follow the run, and steer or stop it from your UI.

    miosa run follow <run-id>
    miosa run steer --sandbox coding-agent-product-task-1 "also add tests"
    miosa run interrupt --sandbox coding-agent-product-task-1

    Check: The UI shows live events; a steer lands on the next turn; interrupt stops the agent.

  5. Verify independently of the agent: run the test command yourself.

    miosa exec coding-agent-product-task-1 --cwd /workspace/repo -- npm test

    Check: Tests exit 0 in the sandbox, not just in the agent's summary.

  6. Hand back the result: collect files and the diff, and push the branch if the task asks for it.

    miosa run files <run-id>
    miosa run download <run-id> <file-id> --output ./result
    miosa exec coding-agent-product-task-1 --cwd /workspace/repo -- git push origin task/<task-id>

    Check: The diff is reviewable outside the sandbox and the run id is attached to it.

  7. Close out. For one-shot tasks let MIOSA do it (`miosa prompt --new-machine ... --after-run destroy`); keep or snapshot the sandbox when the user may continue.

    Check: No orphaned sandboxes remain after the task is closed.

  8. Ship your product UI (a normal web app: task form, live events, diff viewer) as a deployment, built in its own sandbox.

    miosa create coding-agent-product-ui --template nextjs --wait
    miosa deploy create --from-sandbox coding-agent-product-ui --name coding-agent-product --dir /workspace --port 3000 --run-command "npm start" --wait

    Check: The public_url serves the task UI and submits a task end to end.

Limits and costs

Set `--max-time` on every run so a stuck agent cannot run forever; use `--notify-email` or a webhook for long tasks.

Give the agent a token scoped to one repository, and only the permissions the task needs.

Parallel tasks multiply cost: cap concurrency per user or customer.

Prototype: keep it to one machine at the default size, skip replicas and custom hostnames you do not need, and delete everything when you are done.

Acceptance checks

Two tasks run at the same time in two sandboxes without touching each other.

A finished task leaves a reviewable branch or diff and the run id.

Nothing was deployed or published: the deliverable is the diff.

Each customer is isolated in its own workspace and usage is metered against them.

Everything it created can be deleted with nothing left running.

Next steps

Was this page helpful?