Overview of Major Changes
Droidrun v4 introduces several breaking changes:- Installation method changed from
piptouv - Python version requirement increased from 3.10+ to 3.11+
- Configuration system completely redesigned with
DroidrunConfig - Agent API simplified with config-based initialization
- LLM initialization now handled through config profiles
- Result format changed from dictionary to
ResultEventobject - Credential Manager feature included for secure handling of sensitive data
- App Instruction Cards for improved app navigation
- Custom Tools support for extending agent capabilities
- Output Extraction using Pydantic models for structured data
Installation Changes
v3 Installation
v4 Installation
For CLI usage only:droidrun now provides a --version flag — verify your installation with droidrun --version after installing.
Migration Steps
-
Install uv (if not already installed):
-
Uninstall v3 (optional but recommended):
- Install v4 using your preferred method above
- Update Python version to 3.11+ if needed
Configuration System Changes
v3: No Config Files
v3 had no configuration files. All settings were passed directly to the agent.v4: Configuration-Driven Approach
v4 uses aconfig.yaml file that is automatically created on first run:
Migration Steps
-
Create config.yaml (automatically created on first run, or copy from
config_example.yaml) - Define your LLM profiles in the config file instead of in code
-
Set environment variables for API keys:
API Changes
Agent Initialization
v3 Code:Key Differences
| Feature | v3 | v4 |
|---|---|---|
| LLM Setup | Manual instantiation | Loaded from config profiles |
| Tools Loading | Manual AdbTools() | Automatic from config |
| Configuration | Constructor parameters | DroidrunConfig object |
| API Keys | In code | Environment variables |
Result Object Changes
v3: Dictionary Result
v4: ResultEvent Object
Migration Steps
Update all result access patterns:result['success']→result.successresult.get('output')→result.reason(or appropriate attribute)- Add access to new fields:
result.steps
CLI Changes
New CLI Flags
v4 introduces additional flags:| Flag | Description | Default |
|---|---|---|
--config, -c | Custom config path | config.yaml |
--device, -d | Device serial or IP | Auto-detect |
--tcp | Use TCP instead of content provider | false |
--save-trajectory | Save execution data | none |
Breaking Changes Summary
1. Python Version
- v3: Python 3.10+
- v4: Python 3.11+
- Action: Update your Python installation
2. Installation Tool
- v3:
pip install - v4:
uv tool installoruv pip install - Action: Install
uvand use new commands
3. Import Changes
4. Agent Constructor
5. LLM Management
- v3: Manually instantiate LLM objects
- v4: Define profiles in
config.yaml, loaded automatically - Action: Move LLM configs to
config.yaml
6. Tools Loading
- v3:
tools = AdbTools()required - v4: Tools loaded automatically from config
- Action: Remove manual
AdbTools()instantiation
7. Result Access
- v3: Dictionary with string keys
- v4: Object with attributes
- Action: Update result access patterns
Step-by-Step Migration Guide
Step 1: Update Environment
Step 2: Install v4
Step 3: Create Configuration
config.yaml to add your LLM profiles:
Step 4: Set Environment Variables
Step 5: Update Your Code
Before (v3):Step 6: Test Your Migration
New Features in v4
Droidrun v4 introduces several powerful new features that weren’t available in v3. Here’s a quick overview:1. Structured Output Extraction
Extract typed data from device interactions using Pydantic models:2. Credential Management
Securely manage passwords, API keys, and tokens without hardcoding them:type_secret() to securely input sensitive data. You can also store credentials in a credentials.yaml file. → See Credential Management Documentation for YAML configuration and advanced usage.
3. App Instruction Cards
Teach agents how to use specific apps with custom instruction guides:- Navigate the UI efficiently
- Find buttons and features quickly
- Use app-specific shortcuts and search syntax
- Complete tasks with higher success rates
4. Custom Tools
Extend agent capabilities with custom Python functions for external APIs, data processing, or domain-specific logic:5. Advanced Configuration System
v4 introduces granular configuration for all aspects of agent behavior:6. Per-Agent LLM Configuration
Use different LLMs for different agent roles (planning, execution, code generation):7. Custom Variables
Pass non-sensitive contextual data to agents:shared_state.custom_variables and can be used in custom tools or referenced by agents.
→ See Custom Variables Documentation for usage patterns.
8. Tracing and Trajectory Recording
Monitor agent execution with real-time Phoenix tracing and local trajectory recording:- LLM calls with prompts and token usage
- Agent workflow execution
- Tool invocations and results
- Screenshots per step/action
- UI state and element hierarchies
- Agent reasoning and decisions
trajectories/ directory for offline debugging.
→ See Tracing Documentation for Phoenix setup, configuration options, and trajectory analysis.
Last updated: November 2025