Skip to main content
Tasks represent automation workflows to be executed on a mobile device. They are defined using natural language goals and can return structured, type-safe results.

Task Characteristics

Goal-based

Define what you want using natural language

Traceable

Record execution for debugging and visualization

Structured Output

Return typed Pydantic models

Platform Tasks

Using the platform? Create tasks on platform.mobile-use.ai/tasks and execute them with PlatformTaskRequest.

Creating Platform Tasks

  1. Go to Tasks on the platform
  2. Click Create Task
  3. Configure task details:
    • Name: Unique identifier (e.g., check-notifications)
    • Agent Prompt: Detailed instructions
    • Output Description: Optional structured output format
    • Locked App Package: Optional app package to restrict execution (e.g., com.whatsapp)
  4. Use in your code:

Platform Task with Structured Output

Platform Task with Locked App Package

When creating a task on the platform, you can specify a Locked App Package to restrict the agent to a specific app:
The task will be displayed with a πŸ”’ indicator showing the locked package. Using the <locked-app-package> placeholder: You can reference the locked app package in your agent prompt using the <locked-app-package> placeholder:
This placeholder will be automatically replaced with the configured package name at execution time.

Platform Task Benefits

Centralized Management

Update task prompts on the platform without redeploying code

Built-in Observability

View execution details, costs, and agent thoughts on the platform

Team Collaboration

Share tasks across your organization

Version Control

Track changes to task configurations over time

Local Tasks

For local development, define tasks directly in code:

Simple String Output

The most basic way to run a local task:

Structured Output with Pydantic

Get type-safe, validated output:

With Output Description

Provide guidance for unstructured output:

Task Options

Naming Tasks

Give your tasks descriptive names for logging:

Using Different Profiles

Switch agent profiles for specific tasks:

Maximum Steps

Control how many actions the agent can take:

App Lock

Restrict task execution to a specific app:
When app lock is enabled, the agent will:
  • Verify the app is open before starting
  • Attempt to launch it if not in foreground
  • Monitor app changes during execution
  • Automatically relaunch if needed

Task Builder Pattern

For advanced configuration, use the builder pattern:

Tracing and Debugging

Enable trace recording to capture screenshots and execution steps:
Traces include screenshots at each step, making it easy to debug failed tasks.

Saving Output

Save LLM Output

Save the final LLM response to a file:

Save Agent Thoughts

Capture the agent’s reasoning process:

Complex Output Structures

Define complex, nested output structures:

Task Execution Flow

1

Goal Analysis

LLM analyzes the goal and creates a plan
2

Screen Observation

Agent captures current screen state
3

Action Decision

LLM decides next action based on goal and screen
4

Action Execution

Hardware bridge performs the action
5

Verification

Agent checks if goal is achieved
6

Output Extraction

If specified, extract structured output

Best Practices

Define clear field descriptions to help the LLM understand what to extract
Instead of one complex task, run multiple simpler tasks in sequence
Always enable tracing when developing or debugging tasks

Example: Multi-Step Workflow

Next Steps

Profiles

Customize agent behavior

Task Builder SDK

Detailed task configuration SDK