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. Define tasks directly in code with natural language goals. This keeps prompts, outputs, and review history in your codebase.
Hosted task definitions and PlatformTaskRequest execution have been removed. Migrate hosted tasks to goals and task requests defined in your codebase.

Task Characteristics

Goal-based

Define what you want using natural language

Traceable

Record execution for debugging and visualization

Structured Output

Return typed Pydantic models

Running 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