Skip to main content
Create a hosted device, give the managed agent a goal, and read the answer. These examples use the Cloud API; for your own device and local agent, see the Framework Quickstart. AI credits pay for the agent; phone credits pay while the device runs.
1

Get an API key

Sign in or create an account, then create a cloud API key (dr_sk_…). You do not need your own model key, but you can bring your own. Export it for the examples:
2

Install

Use SDK 6.2.0 or later for TypeScript and Python, and v6.4.0 or later for Go. All SDKs read MOBILERUN_API_KEY automatically.
3

Run your first task

Create a device, run the task, print the answer, then stop the device.
4

Read the result

task.wait() returns the same response as GET /tasks/{id}/status:
The message field holds the agent’s natural-language answer. The output field holds your structured data when you submitted an outputSchema, and it is null otherwise. See Agent configuration for more.See the task trajectory for the full record of screenshots and actions (GET /tasks/{id}/trajectory).

Details

The TypeScript example uses top-level await, so run it as an ES module. Set "type": "module" in your package.json, or save it as quickstart.mts, and run it with npx tsx quickstart.ts (or npx tsx quickstart.mts).
This example uses pay as you go (billing: 'minute'). Step 5 stops the device: it keeps its apps and data and uses no phone credits until you resume it, but still occupies a device slot. Call device.terminate() (Go: device.Terminate(ctx, mobilerun.DeviceTerminateParams{})) when you no longer need it. See Cloud Android to compare pay as you go with a monthly subscription.Cloud iOS devices cannot be stopped yet; call device.terminate() instead.
Replace device creation with await mobilerun.devices.get('DEVICE_ID') in TypeScript, mobilerun.devices.get("DEVICE_ID") in Python, or client.Devices.Get(ctx, "DEVICE_ID") in Go. Remove the stop call if it should keep running. See Mobilerun SDK for resuming devices and SDK helpers for all helpers.
task.wait() returns the final status on completion. If the task fails or is cancelled, it throws WaitFailureError in TypeScript or raises it in Python. In Go, task.Wait(ctx) returns a *sdk.WaitFailureError; check for it with errors.As.
Pass llmModel to pick the model that drives the agent. Use one of the identifiers from the cloud model catalog. For example, mobilerun/mobile-agent-fast is tuned for speed and cost, while mobilerun/mobile-agent-thinking gives stronger reasoning for complex flows. Omit the field to use the default, mobilerun/mobile-agent-fast.

SDK and API reference

Automate it

Working with tasks

Configure the agent and read task results.

Routines

Turn repeatable work into routines.

Serverless Functions

Run code without managing a server.

Sandboxes

Run your automation in a sandbox.
Examples: TypeScript task runner · Python signed webhook receiver.