Build a browser and computer-use agent
~25 min TypeScript PythonWhat you’re building: An agent that browses, clicks and fills forms to finish a task.
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 soon1 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
Reference pattern
Browser and computer-use agent, by You (a pattern) (/docs/computers/overview): an agent that drives a real browser or desktop to finish a task, with a person approving consequential steps.
How it works: A goal goes to an agent that sees the screen (screenshot), decides, and acts (click, type, key, launch) in a loop until the task is done; logins and confirmations wait for a person on the same live desktop.
Key capabilities:
Drives a real browser or desktop
Multi-step tasks on real sites
Human takeover for logins and approvals
Returns a summary and the files it produced
This is a pattern, not a copy of one product. Open /docs/computers/overview, then design the smallest version that does the capabilities above.
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()
The agent loop -> agent runs (`miosa prompt`, client.runs) streaming events that drive the computer
Approvals and takeover -> agent runs (`miosa prompt`, client.runs) streaming events, agent approvals, and a shared desktop a person can take over
Goal
Build An agent that browses, clicks and fills forms to finish a task. 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 drives a real browser or desktop to finish a task, with a person approving consequential steps
A goal goes to an agent that sees the screen (screenshot), decides, and acts (click, type, key, launch) in a loop until the task is done; logins and confirmations wait for a person on the same live desktop.
Primitives you'll use: Computer · Sandbox · Agent and harness
- Drives a real browser or desktop
- Multi-step tasks on real sites
- Human takeover for logins and approvals
- Returns a summary and the files it produced
This is a pattern, not a copy of one product. Start from the related MIOSA guide and build the smallest version that does the capabilities above.
What you need on MIOSA
Each row is one thing to create before you start. The number matches the step that uses it.
- Organization and API key Scopes every call; a workspace key is all a worker needs.
miosa api-key create app-key --preset agentDocs - Computer A persistent Linux desktop for browser, mouse, and screenshot work.
miosa computer create app-desktopDocs - Sandbox The isolated Linux workspace the agent writes code and runs commands in.
miosa create app-box --template nextjs --waitDocs - A workspace per customer Isolates each customer’s machines, deployments, and data as they onboard.
miosa workspace create customer-1Docs - Branding and white-label Your name and slug on previews, deployments, and the desktop; customers never see MIOSA.
miosa orgDocs - Usage metering and bill-to Usage per customer, and which account pays for new machines.
miosa org billDocs - Agent and harness Turns a prompt into work: pick the harness and model a run uses.
miosa agent harnessesDocs
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()
The agent loop -> agent runs (`miosa prompt`, client.runs) streaming events that drive the computer
Approvals and takeover -> agent runs (`miosa prompt`, client.runs) streaming events, agent approvals, and a shared desktop a person can take over
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 chatgpt-agent-customer-1Tag 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
Create the computer the agent works on: a persistent Linux desktop with a real browser.
miosa computer create chatgpt-agent-desktopmiosa create chatgpt-agent-work --template python-data --waitCheck: computer.screenshot() returns an image of the desktop and the work sandbox is running.
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.
Dispatch the goal to the harness on the computer.
miosa prompt --computer chatgpt-agent-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.
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.
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 approvalsCheck: Nothing consequential runs without an approval record, and a takeover leaves the agent able to continue.
Long-running work: allow hours, watch progress, steer or stop.
miosa run follow <run-id>miosa run steer --computer chatgpt-agent-desktop "focus on the pricing page"miosa run interrupt --computer chatgpt-agent-desktopmiosa extend chatgpt-agent-desktopCheck: Closing the UI does not stop the run, and reopening it shows current progress.
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 ./resultCheck: 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.