Back to Blog
Tutorial

Emily Watson6 min
Ctrl+C

You have a PyAutoGUI script that clicks pixels and moves the mouse. It works on your machine but breaks when UI changes or layout shifts. You need a way to transform those raw pixel commands into structured actions the computer use API understands. The Coasty parse endpoint does exactly that. It takes PyAutoGUI code and returns a JSON schema of actions you can reuse across different environments. No fragile selectors. Just reliable, pixel-aware automation.

How the parse endpoint works

The parse endpoint is a free tool that reads PyAutoGUI code and builds a structured action schema. You send the code as text and receive a JSON object with action definitions and coordinates. The endpoint is located at POST /v1/parse. It does not charge per request. The response includes a list of actions with fields like type, x, y, button, and duration. These fields map directly to actions the computer use API accepts. You can then pass the schema to session-based prediction or task runs without rewriting your logic.

bash
#!/bin/bash
COASTY_API_KEY="${COASTY_API_KEY}"

# Example PyAutoGUI code to parse
PYAUTOGUI_CODE=$(cat <<'EOF'
import pyautogui
pyautogui.moveTo(100, 200)
pyautogui.click()
pyautogui.mouseDown()
pyautogui.mouseUp()
pyautogui.dragTo(300, 400, duration=0.5)
EOF
)

# Call the parse endpoint
curl -s -X POST "https://coasty.ai/v1/parse" \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "'"$PYAUTOGUI_CODE"'"
  }' | jq

What you get back

  • A JSON array of action objects with type, x, y, button, and duration fields.
  • Coordinates normalized to a 1920x1080 screen by default, but you can adjust scaling.
  • Action types include moveTo, click, mouseDown, mouseUp, and dragTo.
  • The schema is ready to feed into session-based prediction or task runs.

POST /v1/parse is free and returns a structured action schema from PyAutoGUI code.

Where this beats brittle automation

Pixel-based actions adapt to layout changes. If a button moves ten pixels down, your script still clicks the right spot. That is not possible with static selectors. The Coasty computer use API uses vision to see the screen and act like a human. By converting PyAutoGUI code into structured actions, you keep pixel accuracy while gaining the benefits of a computer use agent. You can run these actions on cloud machines, browsers, or terminals without manual debugging. You also avoid brittle selectors that break when UI updates.

Start converting PyAutoGUI scripts into structured actions with the free parse endpoint. Use the schema in session prediction or task runs to build scalable computer use agents. Get your API key at https://coasty.ai/developers and try it today.

© 2026 Coasty

Backed byYCombinator