DroidAgent
- When
reasoning=False: Uses FastAgent directly for immediate execution - When
reasoning=True: Uses ManagerAgent (planning) + ExecutorAgent (actions) + ScripterAgent (off-device operations)
DroidAgent.__init__
goalstr - User’s goal or command to executeconfigDroidrunConfig | None - Full configuration object (required if llms not provided). Contains agent settings, LLM profiles, device config, and more.llmsdict[str, LLM] | LLM | None - Optional LLM configuration:dict[str, LLM]: Agent-specific LLMs with keys: “manager”, “executor”, “fast_agent”, “text_manipulator”, “app_opener”, “scripter”, “structured_output”LLM: Single LLM instance used for all agentsNone: LLMs will be loaded from config.llm_profiles
custom_toolsdict - Custom tool definitions. Format:{"tool_name": {"parameters": {...}, "description": "...", "function": callable}}. These are merged with auto-generated credential tools.credentialsUnion[dict, CredentialManager, None] - Direct credential mapping{"SECRET_ID": "value"}, a CredentialManager instance, or None. If None, credentials will be loaded from config.credentials if available.variablesdict | None - Custom variables accessible throughout execution. Available in shared_state.custom_variables.output_modelType[BaseModel] | None - Pydantic model for structured output extraction from final answer. If provided, the final answer will be parsed into this model.promptsdict[str, str] | None - Custom Jinja2 prompt templates to override defaults. Keys: “fast_agent_system”, “fast_agent_user”, “manager_system”, “executor_system”, “scripter_system”. Values: Jinja2 template strings (NOT file paths).driverDeviceDriver | None - Pre-configured device driver instance (AndroidDriver or IOSDriver). If None, a driver will be created from config.state_providerStateProvider | None - Pre-configured state provider instance. If None, a state provider will be created from config.timeoutint - Workflow timeout in seconds (default: 1000)
DroidAgent.run
ResultEvent- Result object with the following attributes:success(bool): True if task completed successfullyreason(str): Success message or failure reasonsteps(int): Number of steps executedstructured_output(Any): Parsed Pydantic model (if output_model provided, otherwise None)
Event Types
DroidAgent emits various events during execution: Workflow Events:StartEvent- Workflow startedManagerInputEvent- Manager planning phase startedManagerContextEvent- Manager received context for planningManagerResponseEvent- Manager intermediate responseManagerPlanEvent- Manager created a planManagerPlanDetailsEvent- Manager plan detailsExecutorInputEvent- Executor action phase startedExecutorContextEvent- Executor received contextExecutorResponseEvent- Executor intermediate responseExecutorActionEvent- Executor action detailsExecutorActionResultEvent- Executor action result detailsExecutorResultEvent- Executor completed an actionScripterExecutorInputEvent- ScripterAgent startedScripterExecutorResultEvent- ScripterAgent completedTextManipulatorInputEvent- TextManipulatorAgent startedTextManipulatorResultEvent- TextManipulatorAgent completedFastAgentExecuteEvent- FastAgent started (direct mode)FastAgentResultEvent- FastAgent completedFinalizeEvent- Workflow finalizingStopEvent- Workflow completed
ToolExecutionEvent- Emitted by ToolRegistry after every tool dispatch (containstool_name,tool_args,success,summary)ScreenshotEvent- Screenshot capturedRecordUIStateEvent- UI state recorded
Configuration
DroidAgent uses a hierarchical configuration system. See the Configuration Guide for details. Key configuration options:Advanced Usage
Custom Tools instance:Notes
- Config requirement: Either
configorllmsmust be provided. Ifllmsis not provided,configis required to load LLMs from profiles. - Vision mode: Enabling vision (agent_config.*.vision = True) increases token usage as screenshots are sent to the LLM.
- Reasoning mode:
reasoning=Trueuses Manager/Executor workflow for complex planning.reasoning=Falseuses FastAgent for direct execution. - Safe execution: When enabled, restricts imports and builtins in FastAgent and ScripterAgent (see safe_execution config).
- Timeout: Default is 1000 seconds. Increase for long-running tasks.
- Credentials: When credentials are provided, the
type_secret(secret_id, index)tool is automatically registered. The agent never sees the actual secret values, only the secret IDs.

