agentleFS
hajekimhajekim/agentic-design-patterns-extension/skills/appendix-gui-agents/SKILL.md

appendix-gui-agents

Skill1 starsChanged 8 months agoMITView on GitHub

This skill should be used when the user wants to build "GUI agent", "computer use agent", "browser automation agent", "desktop automation", "visual agent", "screen interaction agent", "web automation agent", "agent computer interaction", "ACI agent", "click automation", "multimodal agent with vision", "Project Mariner style agent", "automate browser", "web scraping agent", "UI automation", "automate clicks", "visual web agent", "browser control agent", or agents that perceive and interact with graphical user interfaces, web browsers, or physical-world environments. Also responds to Korean: "GUI 에이전트", "컴퓨터 사용 에이전트", "브라우저 자동화 에이전트", "데스크톱 자동화", "시각 에이전트", "화면 상호작용 에이전트", "웹 자동화", "브라우저 에이전트 만들어줘", "화면 자동화", "마우스 클릭 자동화", "웹사이트 자동으로 조작해줘", "컴퓨터 화면 보고 작업해줘". Also responds to Japanese: "GUIエージェント", "コンピューター使用エージェント", "ブラウザ自動化", "デスクトップ自動化", "マウスクリック自動化", "ウェブサイトを自動操作したい", "画面を見て作業するエージェント", "ビジュアルエージェント", "UI自動化", "ウェブスクレイピングエージェント" Also responds to Chinese: "GUI智能体", "计算机使用智能体", "浏览器自动化", "桌面自动化", "鼠标点击自动化", "自动操作网站", "看屏幕来工作的智能体", "视觉智能体", "UI自动化", "网页爬虫智能体".. Apply this skill to design or implement agents that interact with computers and real-world environments beyond APIs.

  • Installs packages

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Rule of thumb: If a human can do it by looking at a screen and clicking, a GUI agent can automate it — but expect higher latency and error …

    line 29
  2. Distinctive:

    Always verify actions: After each click/type, capture a new screenshot and confirm the expected change occurred

    line 306
  3. Distinctive:

    Ignoring visual feedback: After each action, verify the result — a click that misses or a type into the wrong field can derail the entire …

    line 316

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Appendix B - AI Agentic Interactions: From GUI to Real World

Overview

GUI and Real-World Interaction enables agents to transcend API-based automation and interact directly with graphical user interfaces and physical environments — just as humans do. This represents a fundamental shift: instead of requiring specialized API access for every system, agents can use the visual "front door" of any software, making them universally adaptable.

This pattern is powered by Agent-Computer Interfaces (ACIs) — the layer that allows AI to perceive visual elements (screenshots), reason about them (what is this button?), and act on them (click, type, scroll). Beyond digital interfaces, real-world agents extend to cameras, microphones, and physical sensor inputs.

Core Principle: Any software a human can use visually, an agent with computer use capabilities can operate — without requiring API access or custom integrations.

When This Skill Applies

Activate this pattern when:

  • The target system has no API but has a visual interface (legacy software, web apps)
  • Automating complex workflows that span multiple applications
  • Building agents that must operate like a human user (form filling, navigation, data extraction from GUIs)
  • Integrating with systems where API access is unavailable or too restrictive
  • Building multimodal agents that respond to visual + voice + text inputs simultaneously
  • Prototyping new workflows that will later be formalized with APIs

Rule of thumb: If a human can do it by looking at a screen and clicking, a GUI agent can automate it — but expect higher latency and error rates than API-based automation.

Agent-Computer Interface (ACI) Architecture

┌─────────────────────────────────────────────┐
│           ACI Processing Pipeline            │
│                                             │
│  1. Visual Perception                       │
│     └── Screenshot capture                 │
│                                             │
│  2. GUI Element Recognition                 │
│     └── Identify buttons, fields, links     │
│                                             │
│  3. Contextual Interpretation               │
│     └── LLM: "magnifying glass = search"   │
│                                             │
│  4. Dynamic Action & Response               │
│     └── Click, type, scroll, drag           │
│                                             │
│  5. Feedback Monitoring                     │
│     └── New screenshot → verify action     │
└─────────────────────────────────────────────┘

Leading Implementations

Digital GUI Agents

SystemProviderKey Strength
ChatGPT OperatorOpenAIDesktop-wide automation, CRM/form/travel booking
Project MarinerGoogleChrome browser agent, web task autonomy
Computer UseAnthropicFull desktop control via Claude, multi-app workflows
Browser UseOpen SourceHigh-level Python API for browser DOM control

Real-World / Multimodal Agents

SystemProviderKey Strength
Project AstraGoogle DeepMindUniversal agent via camera + microphone, real-time
Gemini LiveGoogleVoice conversation with visual context (camera/screen)
GPT-4oOpenAIRealtime API for low-latency voice+vision interactions
ChatGPT AgentOpenAIIntegrated web browsing + code execution + app control
Claude 4 SeriesAnthropicVision + reasoning for complex multi-step analysis

DEFINE → PLAN → ACTION Workflow

DEFINE

Map GUI interaction requirements:

  1. What is the target interface? (Web browser, desktop app, mobile, physical environment)
  2. What actions are needed? (Click, type, scroll, navigate, extract data, fill forms)
  3. What is the success condition? (How does the agent know the task is complete?)
  4. What error states must be handled? (Pop-ups, loading screens, CAPTCHAs, auth prompts)
  5. What is the acceptable latency? (GUI agents are 10-100x slower than API calls)

PLAN

Design the GUI agent architecture:

  1. Choose interaction method: screenshot+action loop vs. DOM manipulation vs. native desktop
  2. Define the perception pipeline: how screenshots are captured and interpreted
  3. Plan action primitives: click(x,y), type(text), scroll(direction), wait(condition)
  4. Design recovery strategies: what happens when an expected element is not found?
  5. Plan state verification: after each action, confirm the expected change occurred

ACTION

Implement GUI automation:

  1. Capture the current visual state (screenshot)
  2. Send to LLM with task context: "What should I do next to achieve [goal]?"
  3. Parse the LLM response into concrete actions
  4. Execute the action (click, type, etc.)
  5. Capture new screenshot and verify success or detect error
  6. Loop until task complete or max iterations reached

Implementation: Browser Use (Web Automation)

High-Level Browser Agent

# Browser Use: open-source library for AI-driven web automation
# pip install browser-use langchain-google-genai

from browser_use import Agent as BrowserAgent
from langchain_google_genai import ChatGoogleGenerativeAI
import asyncio

async def run_web_task(task: str) -> str:
    """Run a web automation task using an AI browser agent.

    Args:
        task: Natural language description of what to do on the web

    Returns:
        Result of the completed task
    """
    llm = ChatGoogleGenerativeAI(model="gemini-2.5-flash")

    agent = BrowserAgent(
        task=task,
        llm=llm,
    )

    result = await agent.run()
    return result

# Usage
async def main():
    result = await run_web_task(
        "Go to news.ycombinator.com, find the top 5 posts about AI, "
        "and return their titles and point counts as a JSON list"
    )
    print(result)

asyncio.run(main())

Screenshot-Action Loop (Manual Implementation)

from google import genai
import base64
from PIL import Image
import io
from dataclasses import dataclass
from typing import Optional

client = genai.Client()

@dataclass
class UIAction:
    """A single UI action to perform."""
    action_type: str   # "click", "type", "scroll", "wait", "done"
    x: Optional[int] = None       # Click coordinates
    y: Optional[int] = None
    text: Optional[str] = None    # For type actions
    direction: Optional[str] = None  # "up", "down" for scroll
    reason: str = ""

class ScreenshotActionAgent:
    """Agent that operates via screenshot perception and UI actions."""

    def __init__(self, task: str):
        self.task = task
        self.client = genai.Client()
        self.action_history: list[UIAction] = []
        self.max_steps = 20

    def encode_screenshot(self, screenshot_path: str) -> str:
        """Encode screenshot as base64 for multimodal model input."""
        with open(screenshot_path, "rb") as f:
            return base64.b64encode(f.read()).decode()

    def plan_next_action(self, screenshot_path: str) -> UIAction:
        """Given current screenshot, determine next action to take."""
        screenshot_b64 = self.encode_screenshot(screenshot_path)

        history_text = "\n".join([
            f"Step {i+1}: {a.action_type} at ({a.x},{a.y}) - {a.reason}"
            for i, a in enumerate(self.action_history)
        ])

        prompt = f"""You are a GUI automation agent completing this task: {self.task}

Actions taken so far:
{history_text if history_text else "None yet"}

Looking at the current screenshot, determine the SINGLE next action to take.

Respond with JSON:
{{
  "action_type": "click|type|scroll|wait|done",
  "x": <pixel x for click, null otherwise>,
  "y": <pixel y for click, null otherwise>,
  "text": "<text to type, null otherwise>",
  "direction": "up|down|null",
  "reason": "<why this action>"
}}

If the task is complete, use action_type "done"."""

        # Multimodal request with screenshot
        response = self.client.models.generate_content(
            model='gemini-2.5-flash',
            contents=[prompt, {"mime_type": "image/png", "data": screenshot_b64}]
        )

        import json, re
        match = re.search(r'\{[\s\S]+\}', response.text)
        if match:
            data = json.loads(match.group())
            return UIAction(**data)

        return UIAction(action_type="wait", reason="Could not parse action")

    def run_task(self, get_screenshot_fn, execute_action_fn) -> str:
        """Execute the task using screenshot-action loop.

        Args:
            get_screenshot_fn: Callable that returns path to current screenshot
            execute_action_fn: Callable that takes UIAction and executes it

        Returns:
            Task completion summary
        """
        for step in range(self.max_steps):
            screenshot = get_screenshot_fn()
            action = self.plan_next_action(screenshot)

            print(f"Step {step+1}: {action.action_type} - {action.reason}")

            if action.action_type == "done":
                return f"Task completed in {step+1} steps"

            execute_action_fn(action)
            self.action_history.append(action)

        return "Max steps reached — task incomplete"

Anthropic Computer Use Pattern

import anthropic

def computer_use_task(task: str) -> str:
    """Use Claude's computer use capability for desktop automation.

    Requires: pip install anthropic
    Note: Computer use requires appropriate API access and a sandboxed environment.

    Args:
        task: The desktop automation task to complete

    Returns:
        Final response after completing the task
    """
    client = anthropic.Anthropic()

    messages = [{"role": "user", "content": task}]
    tools = [
        {"type": "computer_20241022", "name": "computer", "display_width_px": 1024, "display_height_px": 768}
    ]

    # Agentic loop — Claude uses computer tools until task is done
    while True:
        response = client.beta.messages.create(
            model="claude-opus-4-6",
            max_tokens=4096,
            tools=tools,
            messages=messages,
            betas=["computer-use-2024-10-22"]
        )

        # Check if done
        if response.stop_reason == "end_turn":
            for block in response.content:
                if hasattr(block, 'text'):
                    return block.text

        # Process tool use — in production, execute the actual computer actions
        tool_results = []
        for block in response.content:
            if block.type == "tool_use" and block.name == "computer":
                # Here you would execute the actual action (click, type, screenshot)
                # and return the result (new screenshot as base64)
                action = block.input
                print(f"Computer action: {action.get('action')} at {action.get('coordinate', 'N/A')}")

                # Placeholder: return current screenshot
                tool_results.append({
                    "type": "tool_result",
                    "tool_use_id": block.id,
                    "content": [{"type": "text", "text": "Action executed successfully"}]
                })

        messages.append({"role": "assistant", "content": response.content})
        messages.append({"role": "user", "content": tool_results})

Key Takeaways

  • Visual understanding is powerful but slow: GUI agents work on any software but are 10-100x slower than API calls — use for legacy/inaccessible systems, not as a default
  • ACI pipeline: Perception → Recognition → Interpretation → Action → Verification — all five stages must be robust
  • Always verify actions: After each click/type, capture a new screenshot and confirm the expected change occurred
  • Error recovery is critical: Pop-ups, loading screens, and unexpected states will occur — design explicit recovery logic
  • Sandbox for safety: Computer use agents can cause real-world effects — run in isolated environments with human approval for destructive actions
  • Multimodal is the frontier: Agents that combine vision + voice + text (Project Astra style) represent the most capable interaction paradigm

Anti-Patterns to Avoid

  • Hardcoded pixel coordinates: UI layouts change — use semantic selectors or ask the LLM to identify element positions dynamically
  • No timeout handling: GUIs have loading states — always implement waits with timeouts rather than assuming instant responses
  • Unlimited autonomy on production systems: GUI agents can delete files, send emails, make purchases — require human approval for high-stakes actions
  • Ignoring visual feedback: After each action, verify the result — a click that misses or a type into the wrong field can derail the entire workflow
  • No session management: Multi-step web tasks require consistent browser state — manage cookies, authentication, and session context

Related Skills

Combine this skill with others for common scenarios:

ScenarioSkills to Combine
Multi-step browser automationGUI Agents + Planning + Reasoning
Safe GUI agent with oversightGUI Agents + Human-in-the-Loop + Guardrails
Tool + GUI hybrid agentGUI Agents + Tool Use + Exception Handling
Evaluated GUI automation pipelineGUI Agents + Evaluation + Reflection

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.