Back to Blog
Tutorial

Lisa Chen5 min
Alt+F4

You already have a PyAutoGUI script that clicks a button, waits for a dialog, and types some text. It works on your machine today. But when you move it to another machine, different screen resolution, or a new UI layout, the mouse coordinates break. You need a way to translate those raw clicks into semantic actions that the Coasty computer use API can reliably execute on any desktop.

How the free parse endpoint works

The /v1/parse endpoint takes raw PyAutoGUI code, parses it, and outputs a structured list of actions. It does not execute the script on a real machine. It simply converts the syntax into a format that the vision-based computer use agent understands. The endpoint accepts a base64 screenshot and a string of PyAutoGUI commands. It returns actions where each action contains a type, coordinates, and optional parameters. This lets you reuse existing scripts and make them portable across different environments without rewriting every click.

bash
#!/bin/bash

COASTY_API_KEY="$COASTY_API_KEY"
SCREENSHOT="$(base64 -w0 screenshot.png)"
PYAUTOGUI_CODE="pyautogui.moveTo(500, 300)
pyautogui.click()
pyautogui.moveTo(600, 400)
pyautogui.click()"

curl -X POST https://coasty.ai/v1/parse \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"screenshot\": \"$SCREENSHOT\",
    \"pyautogui_code\": \"$PYAUTOGUI_CODE\",
    \"cua_version\": \"v3\"
  }"

What the response looks like

  • The endpoint returns a JSON object with an actions array where each action has a type.
  • Types include moveTo, click, type, and other actions recognized by the computer use API.
  • Each action contains x and y coordinates derived from the PyAutoGUI code.
  • Optional parameters like text or duration are included when present in the input code.

Use /v1/parse to turn existing PyAutoGUI scripts into reusable structured actions for the Coasty computer use API.

Where this beats brittle automation

PyAutoGUI relies on absolute mouse coordinates. If you deploy to a different screen size or a new browser window on a different monitor, those coordinates no longer point to the correct element. The computer use API uses vision to locate buttons and fields by their appearance. By converting your PyAutoGUI code into structured actions, you give the agent a semantic map of what to do. This lets the agent adapt to layout changes while still following the original intent of your script.

You can now reuse existing PyAutoGUI scripts by converting them into structured actions with the free /v1/parse endpoint. Integrate those actions into a workflow with /v1/runs to let the computer use agent complete the task on any machine. Get your API key at https://coasty.ai/developers and start building more robust automation today.

© 2026 Coasty

Backed byYCombinator