Skip to main content

A framework for controlling Android devices through LLM agents

Project description

Fremko

Android device control framework with LLM-powered agents, a WebSocket control plane, and a FastAPI web UI. Run the server on your computer, connect your phone, and automate interactions (tap, swipe, input, launch apps), stream the screen, and drive goals with your preferred LLM.

Features

  • Control Android devices over WebSocket via an on-device accessibility service (Fremko Portal)
  • Built-in CLI to run a control server or a combined web UI + HTTP API
  • FastAPI endpoints and a minimal web dashboard for live preview and actions
  • Pluggable LLM backends (OpenAI, Anthropic, Google GenAI, DeepSeek, Ollama) via llama-index

Prerequisites

  • Python 3.10+
  • adb available in your PATH. (Optional)
  • An Android device with Developer Options + USB debugging enabled. (Optional)
  • Fremko Portal app (see link below)

Installation

Usage (PyPI):

pip install fremko

Development (from source):

# Requires Python 3.10+
git clone https://github.com/johnmalek312/fremko.git
cd fremko
pip install -e .

Quickstart

  1. Prepare your Android device
  • Enable Developer Options and USB debugging.
  • Install and set up the Fremko Portal app: https://www.github.com/johnmalek312/fremko-portal
  • From your computer, you can also try:
fremko setup   # installs the APK (if needed) and opens Accessibility settings to enable the Portal
fremko enable  # grants accessibility permission to the Fremko Portal app
fremko ping    # verifies the Portal is installed + reachable
  1. Start the server on your computer
fremko web

Then open http://localhost:8080 to view the dashboard.

  1. Connect the phone to the server
  • In the Fremko Portal app on the phone, set the server URL to ws://<your-computer-ip>:10001
  • Once connected, the device appears under Clients in the web UI

CLI

# Run WebSocket server only
fremko server [--provider GoogleGenAI] [--model models/gemini-2.5-flash] [--ws-port 10001]

# Run server + web UI/HTTP API (recommended)
fremko web [--ws-port 10001] [--http-port 8080] [--host 0.0.0.0]

# ADB helpers
fremko devices
fremko connect <ip:port>
fremko disconnect <ip:port>

# Device readiness
fremko enable                  # gives accessibility permission to the Fremko Portal app on your device
fremko setup [-d SERIAL]       # installs the APK (if needed) and enables the Portal accessibility service
fremko ping  [-d SERIAL]       # verifies the Portal is installed + reachable

Common options: --provider, --model, --temperature, --steps, --base_url, --api_base, --reasoning, --reflection, --tracing, --debug.

Web UI and HTTP API

When you run fremko web, a FastAPI app serves the dashboard and a simple API:

  • GET /api/clients — list connected clients
  • GET /api/clients/{id} — client details
  • POST /api/clients/{id}/goal — start an agent goal
  • GET /api/clients/{id}/screenshot — latest screenshot
  • GET /api/clients/{id}/state — accessibility tree + phone state
  • POST /api/clients/{id}/tap — tap at coordinates
  • POST /api/clients/{id}/swipe — straight-line swipe
  • POST /api/clients/{id}/gesture_path — arbitrary path gesture
  • POST /api/clients/{id}/input — input text
  • POST /api/clients/{id}/key — press Android keycode
  • POST /api/clients/{id}/start_app — start an app
  • POST /api/clients/{id}/stream/{start|update|stop} — control device-to-server video stream
  • GET /ws/preview/{id} — WebSocket with JPEG frames for browser preview

Preview streaming is backed by H.264 decoding on the server and JPEG frames to the browser.

Configuration (LLMs)

LLM selection and configuration are handled through llama-index integrations. Set relevant environment variables for your provider:

  • Google GenAI: GOOGLE_API_KEY
  • OpenAI / compatible: OPENAI_API_KEY, optional OPENAI_BASE_URL
  • Anthropic: ANTHROPIC_API_KEY
  • DeepSeek: DEEPSEEK_API_KEY
  • Ollama: ensure the local Ollama service is running and configure base URL if needed

Defaults: provider GoogleGenAI, model models/gemini-2.5-flash.

Troubleshooting

  • No clients in UI: ensure the phone Portal is connected to ws://<host>:10001 and the server is reachable from the device’s network.
  • Accessibility errors: open Accessibility settings on the phone and enable the Fremko Portal service.
  • Screenshots/stream not working: check that screen-capture permissions are granted in the Portal, then re-enable if needed.
  • ADB device not found: verify adb devices, USB debugging, authorization prompts, and cables/drivers.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fremko-0.1.1.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fremko-0.1.1-py3-none-any.whl (97.6 kB view details)

Uploaded Python 3

File details

Details for the file fremko-0.1.1.tar.gz.

File metadata

  • Download URL: fremko-0.1.1.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fremko-0.1.1.tar.gz
Algorithm Hash digest
SHA256 97f55904b4ca41d0ccb4a4574d747b180bc7b85bae1de7c0d15e2329df0380f6
MD5 4c340e73f778554cc40799b49a6d068c
BLAKE2b-256 77ca646e0afbe24872a4a407849b8fa38f84408c0e0d0c72fb4bfbe78a351ef4

See more details on using hashes here.

File details

Details for the file fremko-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fremko-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 97.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fremko-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 235aaed2938e1a6348fac5d8c763eefceaa350eadb19c0502605bd14e61c9435
MD5 c183d0b6ee24d66d1909548f22e424b5
BLAKE2b-256 8e558b056d4dfcb377c3b1d80459a19958bb75f3987f8e6da7302443207bbcb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page