Part 6: Complete Example - MobileAgent

Note: This comprehensive hands-on tutorial is currently under development. Check back soon for a complete MobileAgent implementation walkthrough.

What You'll Build

A fully functional MobileAgent that can:

  • Control Android/iOS devices
  • Perform UI automation
  • Execute touch gestures (tap, swipe, type)
  • Capture screenshots and UI hierarchy
  • Integrate with Galaxy orchestration

Planned Content

1. Platform-Specific Setup

Android

  • ADB (Android Debug Bridge) integration
  • UI Automator framework
  • Accessibility services

iOS

  • XCTest framework
  • Accessibility API
  • Instrument tools

2. Complete Implementation

  • Agent class
  • Processor and strategies
  • State manager
  • MCP server with mobile tools
  • Prompter for mobile UI

3. Advanced Features

  • Multi-device coordination
  • App-specific automation
  • Error recovery strategies
  • Performance optimization

Temporary Reference

For now, study the LinuxAgent implementation as a complete reference:

Key Files

Component File Path
Agent Class ufo/agents/agent/customized_agent.py
Processor ufo/agents/processors/customized/customized_agent_processor.py
Strategies ufo/agents/processors/strategies/linux_agent_strategy.py
States ufo/agents/states/linux_agent_state.py
Prompter ufo/prompter/customized/linux_agent_prompter.py
MCP Server ufo/client/mcp/http_servers/linux_mcp_server.py

Quick Start Template

# Minimal MobileAgent structure (to be expanded)

@AgentRegistry.register(
    agent_name="MobileAgent",
    third_party=True,
    processor_cls=MobileAgentProcessor
)
class MobileAgent(CustomizedAgent):
    def __init__(self, name, main_prompt, example_prompt, platform="android"):
        super().__init__(name, main_prompt, example_prompt,
                         process_name=None, app_root_name=None, is_visual=True)
        self._platform = platform
        self._blackboard = Blackboard()
        self.set_state(self.default_state)

    @property
    def default_state(self):
        return ContinueMobileAgentState()

Previous: ← Part 5: Testing & Debugging
Back to Index: Tutorial Series