Turn PyAutoGUI Code Into Structured Actions With the Free Parse Endpoint
Most desktop automation scripts start as PyAutoGUI snippets because it is easy. But those scripts quickly become brittle. A window might move, an element could be hidden, or the layout could change. You end up with a maintenance nightmare of pixel offsets and hardcoded coordinates. The parse endpoint solves this by turning raw PyAutoGUI code into a structured action list. You can then feed those actions into the Coasty computer use agent or reuse them in workflows. Best of all it is free.
How parse works
The parse endpoint takes raw Python code that uses PyAutoGUI commands and outputs a structured JSON list of actions. You send a POST request to /v1/parse with the code and optional parameters. The response includes a list of actions with fields like type, x, y, button, keys, modifiers, and duration. Each action is ready to be executed by the Coasty agent or stored in a workflow. Since parse is free you can experiment and iterate without affecting your credit balance.
import os
import requests
import json
# Get the API key from the environment
COASTY_API_KEY = os.getenv("COASTY_API_KEY")
# Raw PyAutoGUI code
pyautogui_code = '''
import pyautogui
import time
time.sleep(2)
pyautogui.moveTo(100, 100, duration=0.5)
pyautogui.click()
time.sleep(1)
pyautogui.typewrite("Hello Coasty", interval=0.1)
pyautogui.hotkey("ctrl", "c")
'''
url = "https://coasty.ai/v1/parse"
headers = {
"X-API-Key": COASTY_API_KEY,
"Content-Type": "application/json",
}
payload = {
"code": pyautogui_code,
"language": "python",
"dependencies": ["pyautogui"],
}
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
structured_actions = response.json()
print(json.dumps(structured_actions, indent=2))What you get back
- ●A JSON list of actions
- ●Each action has type, x, y, button, keys, modifiers, and duration fields
- ●Actions are in the same order as the original script
- ●You can store them in a database or pass them to the agent
The parse endpoint turns your PyAutoGUI scripts into reusable structured actions at zero cost.
Where this beats brittle automation
Traditional automation relies on selectors, XPath, or hardcoded integers. When a window moves or changes layout those scripts break. With structured actions you can replace pixel offsets with the Coasty computer use agent. The agent sees the screen, understands context, and clicks or types accordingly. You can also feed actions into workflows that run on real desktops via the /v1/runs and /v1/workflows endpoints. This means less maintenance and more confidence that your scripts keep working.
Start by converting a simple PyAutoGUI script with the parse endpoint. Then use the structured actions in workflows or let the Coasty agent run them on real machines. Sign up for a free API key at https://coasty.ai/developers and begin building human-like automation that scales.