Overview
Mobilerun uses Jinja2 templates for agent prompts. You can customize agent behavior by passing custom template strings toMobileAgent:
prompts parameter accepts Jinja2 template strings, not file paths.
Choosing the Manager Prompt
The Manager chooses its prompt in this order:manager_systempassed toMobileAgent- The file set in
config.agent.manager.system_prompt - The built-in prompt for the selected stateful or stateless mode
Available Prompt Keys
Context Variables
Each agent has access to different variables in its templates:Manager (stateful)
instruction- User’s goalplatform- Active device platformdevice_date- Current device date/timeapp_card- App-specific guidance (empty if none available)error_history- List of recent failed actions with detailscustom_tools_descriptions- Custom tool documentationavailable_secrets- Available credential IDsvariables- Custom variables passed to MobileAgentoutput_schema- Pydantic model schema (if provided)
Manager (stateless)
instruction- User’s goalplatform- Active device platformdevice_date- Current device date/timeprevious_plan- Plan returned on the previous turnprevious_state- Device state from the previous turnmemory- Facts saved by earlier Manager responseslast_thought- Previous manager rationaleprogress_summary- Previous cumulative progress summaryaction_history- Actions and outcomes available for the current turncurrent_state- Current formatted device state
manager_system, use the variables and final response format for the selected Manager mode.
Executor
instruction- User’s goalapp_card- App-specific guidancedevice_state- Current UI treeplan- Current plan from Managersubgoal- Current subgoal from Managerprogress_status- Cumulative progress summaryatomic_actions- Available actions (includes custom tools)action_history- Recent actions with outcomesavailable_secrets- Available credential IDsvariables- Custom variables passed to MobileAgentplatform- Active device platform
FastAgent
System prompt:tool_descriptions- Available tool signaturesavailable_secrets- Credential IDsavailable_tools- Tools available to the agentvariables- Custom variablesoutput_schema- Output model schema (if provided)parallel_tools- Whether the agent can call multiple tools at oncevision- Whether screenshots are includedplatform- Active device platformscreenshot_only- Whether screenshots are used without UI element data
goal- Task descriptionvariables- Custom variables
Manager Response Format
Custom Manager prompts must return one result block:- Use
<plan>...</plan>while work remains. - In stateful mode, finish with
<request_accomplished success="true">...</request_accomplished>, or setsuccess="false"if blocked. - In stateless mode, finish with
<answer success="true">...</answer>, or setsuccess="false"if blocked.
<thought>, <add_memory>, and <progress_summary> blocks may appear before the result.
Valid unfinished response:
Example: Custom Manager Prompt
Example: Using Custom Variables
Custom variables let you inject dynamic context into prompts:Jinja2 Syntax Reference
Variables
Conditionals
Loops
Filters
Best Practices
1. Use Clear Structure
2. Handle Missing Data with Conditionals
3. Document Expected Variables
4. Use Variables for Dynamic Behavior
Complete Example
Key Points
- Pass Jinja2 template strings (not file paths) to
MobileAgent(prompts={...}) - Each agent has different available variables in its template
- Use
variablesparameter to inject custom context - Templates are rendered at runtime with current state
- If no custom prompt provided, default templates are used
- Supports full Jinja2 syntax (conditionals, loops, filters)