Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions minitap/mobile_use/sdk/builders/agent_config_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,31 @@ def __init__(self):
self._servers: ServerConfig = get_default_servers()
self._graph_config_callbacks: Callbacks = None

def add_profile(self, profile: AgentProfile) -> "AgentConfigBuilder":
def add_profile(self, profile: AgentProfile, validate: bool = True) -> "AgentConfigBuilder":
"""
Add an agent profile to the mobile-use agent.

Args:
profile: The agent profile to add
"""
self._agent_profiles[profile.name] = profile
profile.llm_config.validate_providers()
if validate:
profile.llm_config.validate_providers()
return self

def add_profiles(self, profiles: list[AgentProfile]) -> "AgentConfigBuilder":
def add_profiles(
self,
profiles: list[AgentProfile],
validate: bool = True,
) -> "AgentConfigBuilder":
"""
Add multiple agent profiles to the mobile-use agent.

Args:
profiles: List of agent profiles to add
"""
for profile in profiles:
self.add_profile(profile=profile)
profile.llm_config.validate_providers()
self.add_profile(profile=profile, validate=validate)
return self

def with_default_profile(self, profile: str | AgentProfile) -> "AgentConfigBuilder":
Expand Down Expand Up @@ -162,7 +166,7 @@ def with_graph_config_callbacks(self, callbacks: Callbacks) -> "AgentConfigBuild
self._graph_config_callbacks = callbacks
return self

def build(self) -> AgentConfig:
def build(self, validate_profiles: bool = True) -> AgentConfig:
"""
Build the mobile-use AgentConfig object.

Expand All @@ -185,14 +189,17 @@ def build(self) -> AgentConfig:
elif isinstance(self._default_profile, AgentProfile):
default_profile = self._default_profile
if default_profile.name not in self._agent_profiles:
self.add_profile(default_profile)
self.add_profile(default_profile, validate=validate_profiles)
elif nb_profiles <= 0:
llm_config = get_default_minitap_llm_config() or get_default_llm_config()
llm_config = (
get_default_minitap_llm_config(validate=validate_profiles)
or get_default_llm_config()
)
default_profile = AgentProfile(
name=DEFAULT_PROFILE_NAME,
llm_config=llm_config,
)
self.add_profile(default_profile)
self.add_profile(default_profile, validate=validate_profiles)
elif nb_profiles == 1:
# Select the only one available
default_profile = next(iter(self._agent_profiles.values()))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "minitap-mobile-use"
version = "2.7.1"
version = "2.7.2"
description = "AI-powered multi-agent system that automates real Android and iOS devices through low-level control using LangGraph."
readme = "README.md"
license = { file = "LICENSE" }
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading