Skip to main content

Overview

Mobilerun provides real-time event streaming that gives you visibility into agent execution as it happens. This allows you to build UIs, logging systems, or monitoring tools that react to agent actions in real-time. Under the hood, Mobilerun uses llama-index workflows - an event-driven orchestration system that powers the agent architecture.

Basic Usage

Event Types

Used for workflow coordination between MobileAgent and its child agents.
Internal to ManagerAgent, streamed to frontend/logging.
Internal to ExecutorAgent, streamed to frontend/logging.
Internal to FastAgent, used in direct execution mode.

Common Patterns

Building a Live UI

Tracking Token Usage

Logging and Monitoring

Notes

Event Streaming Behavior

  • Events are streamed in real-time as the agent executes
  • Not all events are emitted in every execution (depends on mode and actions)
  • All events are Pydantic models with full type safety
  • The handler object is async - always use await handler to get the final result

Event Emission by Mode

Reasoning Mode (reasoning=True) emits:
  • Coordination: ManagerInputEvent, ManagerPlanEvent, ExecutorInputEvent, ExecutorResultEvent
  • Internal Manager: ManagerContextEvent, ManagerResponseEvent, ManagerPlanDetailsEvent
  • Internal Executor: ExecutorContextEvent, ExecutorResponseEvent, ExecutorActionEvent, ExecutorActionResultEvent
  • Tool execution: ToolExecutionEvent (after every tool dispatch)
  • Visual: ScreenshotEvent, RecordUIStateEvent (when enabled)
Direct Mode (reasoning=False) emits:
  • Coordination: FastAgentExecuteEvent, FastAgentResultEvent
  • Internal FastAgent: FastAgentInputEvent, FastAgentResponseEvent, FastAgentToolCallEvent, FastAgentOutputEvent, FastAgentEndEvent
  • Tool execution: ToolExecutionEvent (after every tool dispatch)
  • Visual: ScreenshotEvent, RecordUIStateEvent (when enabled)
All Modes emit:
  • Finalization: FinalizeEvent, ResultEvent
  • Telemetry: MobileAgentInitEvent, PackageVisitEvent, MobileAgentFinalizeEvent (when telemetry enabled)

Event Categories

Coordination Events - Used for workflow routing between agents (minimal data)
  • Located in mobilerun/agent/droid/events.py
  • Examples: ManagerPlanEvent, ExecutorResultEvent, ExternalUserMessageAppliedEvent
Internal Events - Used for streaming to frontend/logging (full debug data)
  • Located in agent-specific event files
  • Examples: ManagerPlanDetailsEvent, ExecutorActionEvent, FastAgentResponseEvent
Common Events - Emitted during execution (for screenshots, UI state recording, and tool tracking)
  • Located in mobilerun/agent/common/events.py
  • Examples: ScreenshotEvent, RecordUIStateEvent, ToolExecutionEvent
Telemetry Events - Captured for analytics (when enabled)
  • Located in mobilerun/telemetry/events.py
  • Examples: MobileAgentInitEvent, PackageVisitEvent, MobileAgentFinalizeEvent

Learn More