The AgentConfigBuilder provides a fluent interface for configuring agent behavior, device connections, and server settings.
from minitap.mobile_use.sdk.builders import Builders
# Access the builder
config_builder = Builders.AgentConfig
Methods
for_device
Specify a target device instead of auto-detection.
def for_device(
self,
platform: DevicePlatform,
device_id: str
) -> AgentConfigBuilder
Device platform (DevicePlatform.ANDROID or DevicePlatform.IOS)
Device identifier (from adb devices or idevice_id -l)
from minitap.mobile_use.sdk.types import DevicePlatform
config = (
Builders.AgentConfig
.for_device(platform=DevicePlatform.ANDROID, device_id="emulator-5554")
.build()
)
add_profile
Add a single agent profile.
def add_profile(self, profile: AgentProfile) -> AgentConfigBuilder
from minitap.mobile_use.sdk.types import AgentProfile
profile = AgentProfile(name="fast", from_file="fast-config.jsonc")
config = Builders.AgentConfig.add_profile(profile).build()
add_profiles
Add multiple agent profiles at once.
def add_profiles(self, profiles: list[AgentProfile]) -> AgentConfigBuilder
profiles = [
AgentProfile(name="fast", from_file="fast.jsonc"),
AgentProfile(name="accurate", from_file="accurate.jsonc")
]
config = Builders.AgentConfig.add_profiles(profiles).build()
with_default_profile
Set the default agent profile used for tasks.
def with_default_profile(
self,
profile: str | AgentProfile
) -> AgentConfigBuilder
profile
str | AgentProfile
required
Profile name (if already added) or AgentProfile instance
profile = AgentProfile(name="default", from_file="llm-config.defaults.jsonc")
config = (
Builders.AgentConfig
.with_default_profile(profile)
.build()
)
with_hw_bridge
Set the base URL for the Device Hardware Bridge API server.
def with_hw_bridge(self, url: str | ApiBaseUrl) -> AgentConfigBuilder
config = (
Builders.AgentConfig
.with_hw_bridge(url="http://localhost:8001")
.build()
)
with_screen_api
Set the base URL for the Device Screen API server.
def with_screen_api(self, url: str | ApiBaseUrl) -> AgentConfigBuilder
config = (
Builders.AgentConfig
.with_screen_api(url="http://localhost:8000")
.build()
)
with_adb_server
Set the ADB server host and port.
def with_adb_server(
self,
host: str,
port: int | None = None
) -> AgentConfigBuilder
ADB server port (default: 5037)
config = (
Builders.AgentConfig
.with_adb_server(host="localhost", port=5037)
.build()
)
with_default_task_config
Set default configuration for all tasks created by the agent.
def with_default_task_config(
self,
config: TaskRequestCommon
) -> AgentConfigBuilder
# Create task defaults
task_defaults = (
Builders.TaskDefaults
.with_max_steps(500)
.build()
)
# Apply to agent
config = (
Builders.AgentConfig
.with_default_task_config(task_defaults)
.build()
)
Build and return the final AgentConfig object.
def build(self) -> AgentConfig
config = Builders.AgentConfig.with_default_profile(profile).build()
agent = Agent(config=config)
Complete Example
from minitap.mobile_use.sdk import Agent
from minitap.mobile_use.sdk.builders import Builders
from minitap.mobile_use.sdk.types import AgentProfile, DevicePlatform
# Create profiles
fast_profile = AgentProfile(name="fast", from_file="fast-config.jsonc")
accurate_profile = AgentProfile(name="accurate", from_file="accurate-config.jsonc")
# Configure task defaults
task_defaults = (
Builders.TaskDefaults
.with_max_steps(500)
.build()
)
# Build comprehensive agent configuration
config = (
Builders.AgentConfig
.for_device(platform=DevicePlatform.ANDROID, device_id="emulator-5554")
.add_profiles([fast_profile, accurate_profile])
.with_default_profile(fast_profile)
.with_adb_server(host="localhost", port=5037)
.with_hw_bridge(url="http://localhost:8001")
.with_screen_api(url="http://localhost:8000")
.with_default_task_config(task_defaults)
.build()
)
# Create agent with configuration
agent = Agent(config=config)
TaskDefaults Builder
Configure default settings for all tasks:
defaults = (
Builders.TaskDefaults
.with_max_steps(500)
.with_trace_recording(enabled=True)
.build()
)
config = (
Builders.AgentConfig
.with_default_task_config(defaults)
.build()
)
Server Configuration Shortcut
Use with_servers() as a shortcut for configuring all servers:
from minitap.mobile_use.sdk.types import ServerConfig
servers = ServerConfig(
hw_bridge_base_url="http://localhost:8001",
screen_api_base_url="http://localhost:8000",
adb_server_host="localhost",
adb_server_port=5037
)
config = (
Builders.AgentConfig
.with_servers(servers)
.build()
)
Next Steps