Instruction Agent: Enhancing Agent with Expert Demonstration

Yinheng Li, Hailey Hultquist, Justin Wagle, Kazuhito Koishida · DOI

Abstract

Automating complex Graphical User Interface (GUI) tasks remains a significant challenge for Multimodal Large Language Models (MLLMs). While these models excel at short-term interactions, they frequently fail in "long-horizon" workflows where a single error can derail the entire process. This paper introduces the Instruction Agent, a training-free framework that leverages a single human demonstration to guide an agent through complex tasks. By decomposing demonstrations into semantic instructions and implementing a robust verification and backtracking system, the Instruction Agent achieves a 60% success rate on tasks where existing state-of-the-art agents consistently fail.

Introduction

The advancement of MLLMs has significantly improved the capabilities of GUI agents. However, a substantial performance gap remains between these agents and human users, particularly in desktop environments like OSWorld. The primary bottlenecks are identified as planning—determining the sequence of actions—and grounding—accurately mapping those actions to specific UI elements. Long-horizon tasks exacerbate these issues; as the number of steps increases, the cumulative probability of success drops exponentially. Furthermore, novel UI elements and personalized workflows, such as specific browser profiles with saved credentials, present hurdles that general-purpose models struggle to overcome without specific guidance.

The Instruction Agent Framework

To address these challenges, the authors propose the Instruction Agent, a modular system designed to operate at test-time without further training. The architecture consists of two primary components: the Instructor and the Actor.

Overview of the Instruction Agent framework, illustrating the transition from user trajectory to step-by-step execution.

The Instructor records a human demonstration, capturing raw mouse clicks and keystrokes. An LLM (GPT-4o) then processes this log to generate natural language, "location-aware" instructions. Unlike simple macro recorders, this semantic approach allows the agent to understand the intent behind actions, making it resilient to minor UI changes.

The Actor is responsible for executing these instructions through four sub-modules:

  1. Grounder: Utilizes UI-Tars 1.5 to identify the coordinates of UI elements described in the instructions.
  2. Executor: Translates actions into executable Python code using libraries like pyautogui.
  3. Verifier: An LLM-based module that performs a "sanity check" by comparing screenshots before and after an action to confirm the intended outcome.
  4. Backtracker: If a failure is detected (e.g., a misclick or an unexpected pop-up), this module attempts to restore the environment to a previous state and retries the step, preventing a single error from terminating the entire task.

Experimental Evaluation

The framework was evaluated using the OSWorld benchmark. The researchers focused on a subset of 130 tasks that the top three open-source agents (UI-Tars, Agent S2, and InfantAgent) all failed to complete (0% success rate). From this set, 20 tasks were randomly sampled to test the Instruction Agent's performance in high-difficulty, real-world scenarios.

Results and Discussion

The Instruction Agent demonstrated a remarkable ability to break the "0% barrier," achieving a 60% success rate on the selected difficult tasks. This performance highlights the value of expert demonstrations as semantic "hints" rather than rigid scripts. By converting raw inputs into natural language, the system maintains flexibility; the grounding model can locate the correct button even if the UI layout shifts slightly, a common failure point for traditional recorders.

Success rate comparison on a subset of difficult OSWorld tasks, showing Instruction Agent outperforming existing SOTA models.

Ablation studies further underscored the importance of the safety modules. Removing the backtracker reduced the success rate to 45%, while removing both the verifier and backtracker dropped it to 40%. These results confirm that in long-horizon tasks, where the probability of success is the product of individual step success rates ($P_{success} = \prod p_i$), resilience mechanisms are critical. For a 50-step task, even a 95% success rate per step results in only an 8% total success probability. The Verifier and Backtracker transform this linear, "fail-fast" process into a resilient loop capable of recovering from transient errors.

Furthermore, the authors argue that human-in-the-loop efficiency is a key advantage. Providing a quick recording is often more intuitive and less time-consuming for a user than drafting a complex text prompt that might still miss idiosyncratic details of a personalized environment.

Conclusion

The Instruction Agent provides a practical, efficient way for users to "program" GUI agents via ad-hoc recordings. While the agent still trails human performance (72.36% on the full benchmark), it represents a significant step forward in handling complex, personalized desktop workflows. Future work will focus on improving grounding accuracy for small UI elements and developing more sophisticated backtracking strategies for severe environmental divergences.

Summary updated

BibTeX
@misc{li2025instruction,
  author = {Yinheng Li and Hailey Hultquist and Justin Wagle and Kazuhito Koishida},
  title = {{Instruction Agent: Enhancing Agent with Expert Demonstration}},
  year = {2025},
  eprint = {2509.07098},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.07098},
}
Figure