Skip to main content
The mobile-use SDK provides builder classes that offer a fluent, type-safe way to configure agents and tasks. Builders make complex configurations more readable and help prevent errors.

Why Use Builders?

Readable

Chain methods for clear, self-documenting code

Type-Safe

Catch configuration errors at development time

Flexible

Easy to adjust configurations without rewriting code

Discoverable

IDE autocomplete shows all available options

Builders Overview

The SDK provides access to builders through the Builders object:

Agent Config Builder

Configure how the agent connects to devices and servers:

Basic Usage

Available Methods

Set the default agent profile for tasks
Register additional profiles
Target a specific device instead of auto-detection
Configure ADB server connection
Set default configuration for all tasks

Complete Example

Task Request Builder

Create detailed task configurations:

Basic Usage

Available Methods

Set a descriptive name for logging
Limit the number of actions
Specify Pydantic model for output
Describe expected output format
Use a specific agent profile
Enable execution tracing
Save final LLM output to file
Save agent reasoning to file

Complete Example

Task Defaults Builder

Set defaults that apply to all tasks:

Method Chaining

Builders use method chaining for fluent configuration:
Use parentheses and line breaks for readability when chaining many methods.

Type Safety

Builders provide compile-time type checking:

Comparison: With vs Without Builders

Best Practices

Use builders for complex configs

Builders shine when you need multiple configuration options

Simple tasks can use direct calls

For basic tasks, agent.run_task(goal="...") is fine

Create reusable configurations

Build common configs once and reuse them

Leverage IDE autocomplete

Let your IDE suggest available builder methods

Next Steps

Agent SDK

Detailed Agent SDK reference

Task Builder SDK

Complete TaskRequestBuilder reference