Tutorial

Turn PyAutoGUI Code into Structured Actions with the Free Parse Endpoint

Marcus Sterling||7 min
+Z

You write a script with PyAutoGUI to click a button, fill a form, and save a file. The button changes its class, the layout shifts, and your script breaks next week. You could chase selectors and wait times, but that is brittle. The free /v1/parse endpoint turns that PyAutoGUI code into structured actions you can replay on any screen. No selectors. No fragile waits. Just actions that know how to move the cursor, type, and click, even when the layout changes.

How it works

The parse endpoint takes a PyAutoGUI-style script and translates it into a structured list of actions. You send a JSON body with a key called code. The code field should contain a valid PyAutoGUI function call or a series of such calls. The endpoint returns a list of structured actions, each with a type and coordinates, ready to be fed into a computer use agent. This lets you reuse existing scripts while the agent handles the dynamic UI, so you get robust computer use without rewriting everything from scratch.

bash
curl https://coasty.ai/v1/parse \  \
  -H "Authorization: Bearer $COASTY_API_KEY" \  \
  -H "Content-Type: application/json" \  \
  -d '{
    "code": "pyautogui.moveTo(100,200); pyautogui.click(); pyautogui.typewrite("Hello World")"
  }'


# Example response
{
  "actions": [
    {"type": "move_to", "x": 100, "y": 200},
    {"type": "click"},
    {"type": "type", "text": "Hello World"}
  ],
  "request_id": "req_abc123"
}

What you get back

  • actions array containing move_to, click, and type actions with precise x, y, and text fields
  • request_id to track the request for debugging and retries
  • free pricing, so you can iterate without watching your wallet

The parse endpoint is free and returns structured actions that your computer use agent can execute directly.

Where this beats brittle automation

Traditional automation relies on CSS selectors, XPath, or class names that change with every UI update. A single layout change breaks your workflow. The parse endpoint abstracts away those details. You describe what the script does at a high level using PyAutoGUI calls. The endpoint converts that into action objects that the agent can perform based on the current screen. Even if the button moves or the layout shifts, the agent can still locate it and click it, because the agent drives the computer like a human, not a static selector.

Start building resilient computer use agents by converting your existing PyAutoGUI scripts into structured actions with the free parse endpoint. Get your API key at https://coasty.ai/developers and let your agents handle the dynamic UI while you focus on the logic.

Want to see this in action?

View Case Studies
Try Coasty Free