AutoRPA: Efficient GUI Automation through LLM-Driven Code Synthesis from Interactions

Minghao Chen, Xinyi Hu, Zhou Yu, Yufei Yin

The Automation Dilemma: Flexibility vs. Efficiency

Graphical User Interface (GUI) automation currently faces a significant trade-off. On one side, Large Language Model (LLM) agents utilizing paradigms like ReAct are highly adaptable. They "think" at every step, observing the screen and deciding the next action. However, this flexibility comes at a steep cost: they are computationally expensive and slow, especially for repetitive tasks where invoking the LLM for every single click is highly inefficient.

On the other side, traditional Robotic Process Automation (RPA) relies on hard-coded scripts. While fast and cheap to execute, RPA is notoriously brittle and difficult to maintain. A simple UI update—like moving a "Submit" button a few pixels—can break the entire workflow.

AutoRPA bridges this gap. It asks a fundamental question: Can we use the intelligence of an LLM to automatically write robust automation scripts, making them smart enough to handle UI changes but cheap enough to run without constant LLM calls? By distilling LLM reasoning into reusable Python code, AutoRPA slashes token costs by up to 96% while maintaining or exceeding the success rates of state-of-the-art agents.

How AutoRPA Works

AutoRPA automates the creation of robust RPA functions through a three-phase pipeline:

1. Exploration and Translation

First, a standard ReAct-style agent attempts the target task to generate an initial trajectory. To make this data useful for robust scripting, a Translator Agent steps in. It converts "hard-coded" actions (e.g., click(index=5)) into "soft-coded" semantic procedures (e.g., find_element(text="Submit").click()). This ensures the resulting logic relies on the actual meaning of UI elements rather than fragile screen coordinates.

2. RPA Generation via RAG

Next, a Builder Agent takes these translated trajectories and synthesizes a Python function. It leverages Retrieval-Augmented Generation (RAG) against a tree-structured database of past interactions. This allows the Builder to understand the rationale behind specific actions and incorporate complex control flows, such as loops and conditional logic (e.g., "if the button isn't visible, swipe up").

3. Verification & Hybrid Repair

The generated code is then executed in the environment. If the script fails, an Analyzer Agent identifies the exact breakpoint. Instead of discarding the attempt, a ReAct agent takes over from the failure point to finish the task. This "hybrid" trajectory—part script, part LLM reasoning—is fed back to the Builder to iteratively refine and repair the code without human intervention.

Experimental Validation and Key Results

The researchers evaluated AutoRPA across three diverse GUI environments: AndroidWorld (116 task types across 20 real-world apps), WebArena (focusing on the complex Reddit domain), and MiniWoB++ (53 simulated web task types).

The results highlight a massive leap in efficiency and performance:

  • Massive Cost Savings: By shifting from continuous LLM reasoning to code execution, AutoRPA reduced token usage by 82% to 96% compared to standard ReAct agents.
  • Dramatic Speedups: Execution time on AndroidWorld dropped from nearly 5 minutes per task with ReAct to just 1.08 minutes using AutoRPA's generated code.
  • Superior Performance: On AndroidWorld, AutoRPA achieved a 37.0% success rate (using GPT-4o), outperforming baselines like M3A (34.5%) and SeeAct (15.3%).
  • Robust Generalization: The synthesized functions successfully handled different task instances (e.g., booking a flight to a different city) than those used during the building phase, proving the value of soft-coded semantic logic.

Limitations and Future Directions

While AutoRPA presents a major step forward for practical GUI automation, it has a few limitations. The framework currently relies heavily on frontier models like GPT-4o to generate the initial trajectories and synthesize the code; performance drops noticeably with weaker builder models. Additionally, it requires access to the underlying UI structure (like the DOM or Accessibility Tree). While OCR and visual grounding models can serve as workarounds, they reintroduce some token costs.

Finally, while highly effective for procedural tasks, the Builder agent still struggles with extremely long-horizon tasks that require human-level intuition. Future work will focus on autonomous exploration, enabling agents to generate their own rewards and explore tasks without needing initial human-provided examples.

Summary updated

BibTeX
@inproceedings{chen2026autorpa,
  author = {Minghao Chen and Xinyi Hu and Zhou Yu and Yufei Yin},
  title = {{AutoRPA: Efficient GUI Automation through LLM-Driven Code Synthesis from Interactions}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=RbGLc4sk9s},
}
Figure