Back to Blog
Tutorial

David Park5 min
Ctrl+P

You already have a reliable PyAutoGUI script that automates desktop tasks. You want to reuse that logic in a Coasty computer use agent without rewriting every click or keystroke. The /v1/parse endpoint lets you submit raw PyAutoGUI code and get structured actions back, so you can plug those actions into runs, workflows, or the stateful /v1/sessions flow. No per-action charge for parsing.

How it works

Send a POST to https://coasty.ai/v1/parse with your PyAutoGUI snippet. The body expects a "code" field holding the Python source as a string. The endpoint returns a JSON object with a "actions" array where each action contains a "type" (click, type, key_down, key_up, pause, etc.) and the required positional fields (x, y, text, key_name, duration). This output is ready to feed into task steps or stateful session predictions.

bash
curl https://coasty.ai/v1/parse \ \
  -H 'X-API-Key: $COASTY_API_KEY' \ \
  -H 'Content-Type: application/json' \ \
  -d '{
    "code": "pyautogui.click(100, 200)\npyautogui.write("Hello")\npyautogui.keyDown("shift")\npyautogui.write("h")\npyautogui.keyUp("shift")"
  }'

Supported action types

  • "click": requires x and y integer coordinates.
  • "type": requires text string to inject.
  • "key_down" and "key_up": require key_name string such as "enter" or "escape".
  • "pause": optional duration in seconds.
  • All other fields are optional depending on the action type.

Use /v1/parse once to transform your PyAutoGUI script into structured actions, then reuse those actions in task steps that cost $0.05 each.

Where this beats brittle automation

Traditional automation relies on brittle selectors that break when UI changes. The parse endpoint lets you keep your existing PyAutoGUI logic, which is based on pixel coordinates and key events. Once converted, you can hand off those actions to a computer use agent that also sees the screen, so it can adapt to layout shifts while still following your original intent. This hybrid approach reduces maintenance overhead and lets you reuse proven scripts.

You can now take any PyAutoGUI script, parse it into structured actions, and drop those actions into Coasty task runs or workflows. Start building agents that understand your desktop workflows. Get your API key from https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator