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 theBuilders object:
Agent Config Builder
Configure how the agent connects to devices and servers:Basic Usage
Available Methods
with_default_profile
with_default_profile
Set the default agent profile for tasks
add_profile / add_profiles
add_profile / add_profiles
Register additional profiles
for_device
for_device
Target a specific device instead of auto-detection
with_adb_server
with_adb_server
Configure ADB server connection
with_default_task_config
with_default_task_config
Set default configuration for all tasks
Complete Example
Task Request Builder
Create detailed task configurations:Basic Usage
Available Methods
with_name
with_name
Set a descriptive name for logging
with_max_steps
with_max_steps
Limit the number of actions
with_output_format
with_output_format
Specify Pydantic model for output
with_output_description
with_output_description
Describe expected output format
using_profile
using_profile
Use a specific agent profile
with_trace_recording
with_trace_recording
Enable execution tracing
with_llm_output_saving
with_llm_output_saving
Save final LLM output to file
with_thoughts_output_saving
with_thoughts_output_saving
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:Type Safety
Builders provide compile-time type checking:Comparison: With vs Without Builders
- With Builders (Recommended)
- Without Builders
✅ Type-safe
✅ Easy to modify
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 fineCreate 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

