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
2 changes: 1 addition & 1 deletion docs/concepts/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ llm_profiles:
model: gpt-4o
fast_agent:
provider: GoogleGenAI
model: gemini-3.1-flash-lite-preview
model: gemini-3.1-flash-lite
agent:
reasoning: true # Enable Manager/Executor workflow
max_steps: 15 # Maximum execution steps (global)
Expand Down
4 changes: 2 additions & 2 deletions docs/features/structured-output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ By default, extraction uses the `structured_output` LLM profile. If not configur
llm_profiles:
fast_agent:
provider: GoogleGenAI
model: gemini-3.1-flash-lite-preview
model: gemini-3.1-flash-lite
temperature: 0.3

structured_output:
Expand All @@ -140,7 +140,7 @@ from mobilerun import load_llm
config = MobileConfig()

llms = {
"fast_agent": load_llm("GoogleGenAI", "gemini-3.1-flash-lite-preview"),
"fast_agent": load_llm("GoogleGenAI", "gemini-3.1-flash-lite"),
"structured_output": load_llm("OpenAI", "gpt-4o-mini"),
}

Expand Down
6 changes: 3 additions & 3 deletions docs/guides/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ In screenshot-only mode, Mobilerun does not read an accessibility tree. The agen
export GOOGLE_API_KEY=your-key
mobilerun run "Archive old emails" \
--provider GoogleGenAI \
--model gemini-3.1-flash-lite-preview
--model gemini-3.1-flash-lite

# OpenAI
export OPENAI_API_KEY=your-key
Expand Down Expand Up @@ -384,7 +384,7 @@ trajectories/2025-10-16_14-30-45/
```bash Quick Test
mobilerun run "Turn on dark mode" \
--provider GoogleGenAI \
--model gemini-3.1-flash-lite-preview
--model gemini-3.1-flash-lite
```

```bash Debug Task
Expand All @@ -405,7 +405,7 @@ mobilerun run "Check Wi-Fi" \
```bash Cost Optimization
mobilerun run "Set alarm" \
--provider GoogleGenAI \
--model gemini-3.1-flash-lite-preview \
--model gemini-3.1-flash-lite \
--no-vision
```

Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mobilerun run "Find a contact named John and send him an email" --reasoning

**Common CLI flags:**
- `--provider` - LLM provider (GoogleGenAI, OpenAI, Anthropic, etc.)
- `--model` - Model name (gemini-3.1-flash-lite-preview, gpt-4o, etc.)
- `--model` - Model name (gemini-3.1-flash-lite, gpt-4o, etc.)
- `--vision` - Enable screenshot processing
- `--reasoning` - Enable multi-agent planning mode
- `--steps N` - Maximum execution steps (default: 15)
Expand Down
24 changes: 12 additions & 12 deletions docs/sdk/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ CredentialsConfig(
```python
from llama_index.llms.google_genai import GoogleGenAI

llm = GoogleGenAI(model="gemini-3.1-flash-lite-preview", temperature=0.2)
llm = GoogleGenAI(model="gemini-3.1-flash-lite", temperature=0.2)
agent = MobileAgent(goal="...", llms=llm)
```

Expand All @@ -242,10 +242,10 @@ agent = MobileAgent(
goal="...",
llms={
"manager": OpenAI(model="gpt-4o"), # Planning
"executor": GoogleGenAI(model="gemini-3.1-flash-lite-preview"), # Action selection
"fast_agent": GoogleGenAI(model="gemini-3.1-flash-lite-preview"), # Fast Agent: Direct execution (XML tool-calling)
"executor": GoogleGenAI(model="gemini-3.1-flash-lite"), # Action selection
"fast_agent": GoogleGenAI(model="gemini-3.1-flash-lite"), # Fast Agent: Direct execution (XML tool-calling)
"app_opener": OpenAI(model="gpt-4o-mini"), # App launching
"structured_output": GoogleGenAI(model="gemini-3.1-flash-lite-preview"), # Output extraction
"structured_output": GoogleGenAI(model="gemini-3.1-flash-lite"), # Output extraction
}
)
```
Expand Down Expand Up @@ -429,10 +429,10 @@ agent = MobileAgent(
# LLMs
llms={
"manager": OpenAI(model="gpt-4o"), # Planning
"executor": GoogleGenAI(model="gemini-3.1-flash-lite-preview"), # Action selection
"fast_agent": GoogleGenAI(model="gemini-3.1-flash-lite-preview"), # Fast Agent: Direct execution (XML tool-calling)
"executor": GoogleGenAI(model="gemini-3.1-flash-lite"), # Action selection
"fast_agent": GoogleGenAI(model="gemini-3.1-flash-lite"), # Fast Agent: Direct execution (XML tool-calling)
"app_opener": OpenAI(model="gpt-4o-mini"), # App launching
"structured_output": GoogleGenAI(model="gemini-3.1-flash-lite-preview"), # Output extraction
"structured_output": GoogleGenAI(model="gemini-3.1-flash-lite"), # Output extraction
},

# Custom tools
Expand Down Expand Up @@ -505,21 +505,21 @@ agent:
llm_profiles:
manager:
provider: GoogleGenAI
model: gemini-3.1-flash-lite-preview
model: gemini-3.1-flash-lite
temperature: 0.2
kwargs:
max_tokens: 8192

executor:
provider: GoogleGenAI
model: gemini-3.1-flash-lite-preview
model: gemini-3.1-flash-lite
temperature: 0.1
kwargs:
max_tokens: 4096

fast_agent: # Fast Agent: Direct execution (XML tool-calling)
provider: GoogleGenAI
model: gemini-3.1-flash-lite-preview
model: gemini-3.1-flash-lite
temperature: 0.2
kwargs:
max_tokens: 8192
Expand All @@ -531,7 +531,7 @@ llm_profiles:

structured_output:
provider: GoogleGenAI
model: gemini-3.1-flash-lite-preview
model: gemini-3.1-flash-lite
temperature: 0.0

device:
Expand Down Expand Up @@ -585,7 +585,7 @@ mobilerun run "Task" --steps 30 --reasoning --vision
mobilerun run "Task" --device emulator-5554 --tcp

# Override LLM (applies to ALL agents)
mobilerun run "Task" --provider GoogleGenAI --model gemini-3.1-flash-lite-preview
mobilerun run "Task" --provider GoogleGenAI --model gemini-3.1-flash-lite

# Override logging
mobilerun run "Task" --debug --save-trajectory action --tracing
Expand Down
14 changes: 9 additions & 5 deletions mobilerun/agent/providers/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
auth_mode="api_key",
default_model="gemini-3.1-pro-preview",
models=(
"gemini-3.5-flash",
"gemini-3-flash-preview",
"gemini-3.1-pro-preview",
"gemini-3.1-flash-lite-preview",
"gemini-3.1-flash-lite",
),
requires_api_key=True,
),
Expand All @@ -47,7 +48,7 @@
models=(
"gemini-3-flash-preview",
"gemini-3.1-pro-preview",
"gemini-3.1-flash-lite-preview",
"gemini-3.1-flash-lite",
),
credential_path=str(GEMINI_OAUTH_CREDENTIAL_PATH),
),
Expand All @@ -61,8 +62,9 @@
id="OpenAIResponses",
runtime_provider_name="OpenAIResponses",
auth_mode="api_key",
default_model="gpt-5.4",
default_model="gpt-5.5",
models=(
"gpt-5.5",
"gpt-5.4",
"gpt-5.4-mini",
"gpt-5.4-nano",
Expand All @@ -73,11 +75,11 @@
id="openai_oauth",
runtime_provider_name="openai_oauth",
auth_mode="oauth",
default_model="gpt-5.4",
default_model="gpt-5.5",
models=(
"gpt-5.5",
"gpt-5.4",
"gpt-5.4-mini",
"gpt-5.3-codex",
),
credential_path=str(OPENAI_OAUTH_CREDENTIAL_PATH),
),
Expand All @@ -95,6 +97,7 @@
default_model="claude-sonnet-4-6",
models=(
"claude-sonnet-4-6",
"claude-opus-4-8",
"claude-opus-4-6",
"claude-haiku-4-5",
),
Expand All @@ -107,6 +110,7 @@
default_model="claude-opus-4-7",
models=(
"claude-opus-4-7",
"claude-opus-4-8",
"claude-sonnet-4-6",
"claude-opus-4-6",
"claude-haiku-4-5",
Expand Down
15 changes: 13 additions & 2 deletions mobilerun/agent/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
"Ollama",
]

PROVIDER_ALIASES = {
"MobilerunAnthropic": "Anthropic",
"MobilerunOpenAIResponses": "OpenAIResponses",
"openai_responses_llm": "OpenAIResponses",
}


class UsageResult(BaseModel):
request_tokens: int
Expand All @@ -50,7 +56,12 @@ def _usage_field(usage: Any, *names: str) -> int:
return 0


def _normalize_provider_name(provider: str) -> str:
return PROVIDER_ALIASES.get(provider, provider)


def get_usage_from_response(provider: str, chat_rsp: ChatResponse) -> UsageResult:
provider = _normalize_provider_name(provider)
rsp = chat_rsp.raw
if not rsp:
raise ValueError("No raw response in chat response")
Expand Down Expand Up @@ -210,7 +221,7 @@ def llm_callback(llm: LLM, *args: List[BaseCallbackHandler]):


def create_tracker(llm: LLM) -> TokenCountingHandler:
provider = llm.__class__.__name__
provider = _normalize_provider_name(llm.__class__.__name__)
if provider not in SUPPORTED_PROVIDERS:
raise ValueError(f"Tracking not yet supported for provider: {provider}")

Expand Down Expand Up @@ -245,7 +256,7 @@ def track_usage(llm: LLM) -> TokenCountingHandler:
>>> # ... make LLM calls ...
>>> print(f"Total tokens used: {tracker.usage.total_tokens}")
"""
provider = llm.__class__.__name__
provider = _normalize_provider_name(llm.__class__.__name__)
if provider not in SUPPORTED_PROVIDERS:
raise ValueError(f"Tracking not yet supported for provider: {provider}")

Expand Down
Loading
Loading