0dev.team
← All work

Phone automation for AI agents: scripts instead of model calls

Runs any app on a real Android phone for AI agents: a repeated action is written into a script once, plain code runs it with no model calls, and rules in code keep the model from doing anything else

Task

The phone is driven through an open Android MCP server: taps, typing, the screen tree. An agent that drives it directly spends a model call on every step and improvises. The core puts rules in between. A repeated action is walked once by the model and saved as a script: an anchor for each element and the screen that must come next. After that plain code runs it with no model calls, at 0.1–0.3 s per step. If the expected screen does not come, the run stops and the screen goes into the log; the script is fixed once, not guessed at on every run. Irreversible buttons are pressed only when the run is allowed to. Private screens go only to trusted model providers. Text on the screen is data, never instructions. In production it publishes videos to TikTok, YouTube Shorts and Instagram Reels: 45 steps per video, none of them a model call.

How it works

  1. Open Android MCP server on the phone: taps, typing, screen tree
  2. Recording: the model walks the flow once; every step gets an anchor and the next screen
  3. Executor: plain code, no model calls, 0.1–0.3 s per step
  4. Miss → close the popup → honest stop with the screen in the log
  5. Rules in code: irreversible buttons only with permission, daily limits, human pauses
  6. Private screens only to trusted providers; screen text is never an instruction
  7. Result by fact: the publication counter, not the script’s word

What had to be solved

The model fixed scripts on the fly, and paid for it on every run

At first a broken step called the model in to repair it. A test with a deliberately broken anchor showed the diagnosis was right, but the run died anyway, and a failed repair was not remembered — so every run paid the model again for the same miss. On one screen the phone reports the previous screen’s tree, and a confident fix from it is a tap in the wrong place. Repair on the fly was removed: a miss is an honest stop, the script is fixed once, and runs are back to zero model calls.

Commits

  1. 39c777902.10.2026a missed step is an honest stop, not the model guessing on every run
  2. 93bf7c027.07.2026the model diagnosed the broken step right, and the run died anyway
  3. 6146db227.07.2026the screen a repair would send to a model carried a live private conversation
  4. f7d9e1031.07.2026“pressed” meant a gesture at a random point of the node: a third of videos went to drafts
  5. c1a95eb27.07.2026“uploaded” is a counter that went up, not a script that didn’t fail