Build a Cowork-style desktop agent

~25 min TypeScript Python

What you’re building: An agent that works alongside you on your desktop.

Primitives you’ll use: Computer, Sandbox, Agent and harness

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

Claude Cowork, by Anthropic (https://claude.com): an agent that works alongside a user across desktop apps and files.

How it works: Cowork acts on the user's files and apps on their behalf, with the user setting the task and reviewing the outcome.

Key capabilities:

Works across files and desktop apps

Takes multi-step tasks

Asks before consequential actions

Hands back finished files

Build an app LIKE Claude Cowork. It is not affiliated with Anthropic: do not copy its name, branding or assets. Open https://claude.com first, confirm the capabilities above, and note anything this brief missed.

How it maps onto MIOSA

A real desktop and browser -> a MIOSA computer (persistent Linux desktop with a browser)

Sees and acts on the screen -> computer.screenshot(), click(), type(), key(), launch()

Code and files for the task -> a MIOSA sandbox for scripts and artifacts

Long-running work with a human in the loop -> agent runs (`miosa prompt`, client.runs) streaming events, approvals and `miosa run steer` / `interrupt`

Goal

Build an app like Claude Cowork 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>-box --wait

Computer: a persistent Linux desktop with a browser

miosa computer create <product-name>-desktop

Agents and harnesses: what a run can use

miosa agent harnesses

Data and storage

A tasks table in your datastore: task id, goal, plan, computer id, run id, status, approval records and artifact links. The desktop's own files and browser profile persist on the computer.

Code the agent writes and runs belongs in the work sandbox, not on the desktop.

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 computer 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 drives the computer: it looks (screenshot), decides and acts (click, type, key, launch), and repeats. Tell it explicitly which actions need approval.

One computer per user or per task keeps browser sessions and logged-in accounts from mixing.

Steps

1. Create the computer the agent works on: a persistent Linux desktop with a real browser.

miosa computer create <product-name>-desktop

miosa create <product-name>-work --template python-data --wait

Check: computer.screenshot() returns an image of the desktop and the work sandbox is running.

2. Plan before acting: have the agent write a short plan (steps and what "done" means) and keep it with the task so a human can read it.

Check: The plan is stored and shown in the UI before the first action.

3. Dispatch the goal to the harness on the computer.

miosa prompt --computer <product-name>-desktop --harness osa --model <anthropic-model-id> --chat <chat-id> "Goal: <goal>. Plan first, then work in the browser and files, and save deliverables to /workspace/out"

Check: The run starts and the first screenshot arrives within seconds.

4. The see-act loop: screenshot, decide, act, screenshot again. Store every screenshot as evidence.

computer.screenshot()

computer.click(x, y)

computer.type(text)

computer.key("Enter")

computer.launch(app)

Check: Each action is followed by a stored screenshot you can replay.

5. Approvals and human takeover. Consequential actions (sending, buying, deleting, signing in) wait for a person; the person can take over the same live desktop for logins or CAPTCHAs and hand it back.

miosa agent approvals

Check: Nothing consequential runs without an approval record, and a takeover leaves the agent able to continue.

6. Long-running work: allow hours, watch progress, steer or stop.

miosa run follow <run-id>

miosa run steer --computer <product-name>-desktop "focus on the pricing page"

miosa run interrupt --computer <product-name>-desktop

miosa extend <product-name>-desktop

Check: Closing the UI does not stop the run, and reopening it shows current progress.

7. Collect the artifacts (files, documents, exports) and return them with a summary of what was done.

miosa run files <run-id>

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

Check: The user receives the finished files, not just a description of them.

Limits and costs

A computer bills while it runs: set a TTL, extend deliberately with `miosa extend`, and pause idle ones.

Set `--max-time` on runs; hours are normal, unbounded is not.

Never put long-lived credentials on the desktop; sign in through a human takeover so secrets stay with the user.

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

The agent completes a real browser task and the screenshots show the result.

A consequential action stopped for approval.

Artifacts were delivered and the computer persists across turns.

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

an agent that works alongside a user across desktop apps and files Modelled on Claude Cowork, by Anthropic.

Cowork acts on the user's files and apps on their behalf, with the user setting the task and reviewing the outcome.

Primitives you'll use: Computer · Sandbox · Agent and harness

  • Works across files and desktop apps
  • Takes multi-step tasks
  • Asks before consequential actions
  • Hands back finished files

Source: claude.com. Claude Cowork is a trademark of Anthropic; 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. Computer A persistent Linux desktop for browser, mouse, and screenshot work. miosa computer create app-desktop Docs
  3. Sandbox The isolated Linux workspace the agent writes code and runs commands in. miosa create app-box --template nextjs --wait Docs
  4. A workspace per customer Isolates each customer’s machines, deployments, and data as they onboard. miosa workspace create customer-1 Docs
  5. Branding and white-label Your name and slug on previews, deployments, and the desktop; customers never see MIOSA. miosa org Docs
  6. Usage metering and bill-to Usage per customer, and which account pays for new machines. miosa org bill Docs
  7. Agent and harness Turns a prompt into work: pick the harness and model a run uses. miosa agent harnesses Docs

Architecture

How it maps onto MIOSA

A real desktop and browser -> a MIOSA computer (persistent Linux desktop with a browser)

Sees and acts on the screen -> computer.screenshot(), click(), type(), key(), launch()

Code and files for the task -> a MIOSA sandbox for scripts and artifacts

Long-running work with a human in the loop -> agent runs (`miosa prompt`, client.runs) streaming events, approvals and `miosa run steer` / `interrupt`

Data and storage

A tasks table in your datastore: task id, goal, plan, computer id, run id, status, approval records and artifact links. The desktop's own files and browser profile persist on the computer.

Code the agent writes and runs belongs in the work sandbox, not on the desktop.

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 claude-cowork-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 computer 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 drives the computer: it looks (screenshot), decides and acts (click, type, key, launch), and repeats. Tell it explicitly which actions need approval.

One computer per user or per task keeps browser sessions and logged-in accounts from mixing.

Steps

  1. Create the computer the agent works on: a persistent Linux desktop with a real browser.

    miosa computer create claude-cowork-desktop
    miosa create claude-cowork-work --template python-data --wait

    Check: computer.screenshot() returns an image of the desktop and the work sandbox is running.

  2. Plan before acting: have the agent write a short plan (steps and what "done" means) and keep it with the task so a human can read it.

    Check: The plan is stored and shown in the UI before the first action.

  3. Dispatch the goal to the harness on the computer.

    miosa prompt --computer claude-cowork-desktop --harness osa --model <anthropic-model-id> --chat <chat-id> "Goal: <goal>. Plan first, then work in the browser and files, and save deliverables to /workspace/out"

    Check: The run starts and the first screenshot arrives within seconds.

  4. The see-act loop: screenshot, decide, act, screenshot again. Store every screenshot as evidence.

    computer.screenshot()
    computer.click(x, y)
    computer.type(text)
    computer.key("Enter")
    computer.launch(app)

    Check: Each action is followed by a stored screenshot you can replay.

  5. Approvals and human takeover. Consequential actions (sending, buying, deleting, signing in) wait for a person; the person can take over the same live desktop for logins or CAPTCHAs and hand it back.

    miosa agent approvals

    Check: Nothing consequential runs without an approval record, and a takeover leaves the agent able to continue.

  6. Long-running work: allow hours, watch progress, steer or stop.

    miosa run follow <run-id>
    miosa run steer --computer claude-cowork-desktop "focus on the pricing page"
    miosa run interrupt --computer claude-cowork-desktop
    miosa extend claude-cowork-desktop

    Check: Closing the UI does not stop the run, and reopening it shows current progress.

  7. Collect the artifacts (files, documents, exports) and return them with a summary of what was done.

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

    Check: The user receives the finished files, not just a description of them.

Limits and costs

A computer bills while it runs: set a TTL, extend deliberately with `miosa extend`, and pause idle ones.

Set `--max-time` on runs; hours are normal, unbounded is not.

Never put long-lived credentials on the desktop; sign in through a human takeover so secrets stay with the user.

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

The agent completes a real browser task and the screenshots show the result.

A consequential action stopped for approval.

Artifacts were delivered and the computer persists across turns.

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?