Python-based Android test executor service using Droidrun SDK.
- Python 3.9+
- ADB (Android Debug Bridge) installed and in PATH
- Android device connected via USB or emulator running
- Gemini API key (via
.envfile OR provided by Talos AI at runtime)
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
.\venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txt- Create a
.envfile (optional if using Talos AI frontend):
GEMINI_API_KEY=your_gemini_api_key_here
SERVER_URL=http://localhost:3000
EXECUTOR_PORT=8000- Connect an Android device or start an emulator:
# List connected devices
adb devices- Start the executor:
./run_agent.shNote: We use
run_agent.shto ensure the correct Python environment (Miniconda) is used wheredroidrunis installed.
The executor supports two methods for configuring the Gemini API key:
Create a .env file in the executor directory with your API key:
GEMINI_API_KEY=your_gemini_api_key_hereThis key is loaded at startup and used for all executions.
The Talos AI frontend can send the API key at runtime via the /config endpoint:
curl -X POST http://localhost:8000/config \
-H "Content-Type: application/json" \
-d '{"geminiApiKey": "your_api_key_here"}'The dynamically configured key takes precedence over the .env configuration.
- HTTP
/configendpoint - Takes precedence when called .envfile - Used as fallback if no dynamic config is provided
| Method | Endpoint | Description |
|---|---|---|
| POST | /config |
Update API key at runtime |
| GET | /config/status |
Check if executor is configured |
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check |
| GET | /device |
Get connected device info |
| GET | /devices |
List all connected devices |
| POST | /screenshot |
Take a screenshot |
| Method | Endpoint | Description |
|---|---|---|
| POST | /execute |
Start test execution |
| POST | /execute/cancel/{id} |
Cancel running test |
| GET | /execute/status/{id} |
Get execution status |
- Talos AI frontend sends API key to executor via
POST /config - Talos AI frontend sends test cases to the executor via
POST /execute - Executor uses Droidrun SDK to execute each step via natural language
- After each step, a screenshot is captured via ADB
- Results are sent back to Talos server via
POST /api/executor/step-result - Server compares screenshots with AI and pushes updates via SSE
testconn-executor/
├── main.py # FastAPI application entry point
├── config.py # Configuration with runtime update support
├── requirements.txt # Python dependencies
├── .env # Environment variables (optional)
├── .env.example # Example environment file
├── executor/
│ ├── droidrun_agent.py # Droidrun SDK wrapper
│ ├── browser_agent.py # Browser automation wrapper
│ ├── step_runner.py # Executes steps and reports results
│ ├── screenshot.py # ADB screenshot capture
│ └── drivers/ # Platform-specific drivers
│ ├── android.py
│ ├── flutter.py
│ └── web.py
└── api/
└── routes.py # FastAPI route handlers
- Ensure USB debugging is enabled on your device
- Check
adb devicesshows your device - Try
adb kill-server && adb start-server
- Run
pip install droidrun
- Ensure device is unlocked
- Check ADB permissions:
adb shell pm grant com.android.shell android.permission.READ_FRAME_BUFFER
- Either create a
.envfile withGEMINI_API_KEY - Or ensure Talos AI frontend is configured with an API key in Settings
Run with auto-reload:
uvicorn main:app --reload --port 8000Check configuration status:
curl http://localhost:8000/config/status