Tasks
Pause on awaiting_human, hand back with resume
Human takeover
Human takeover, at a glance
Pause on awaiting_human, hand back with resume
POST /v1/runs/{id}/resumeRequest map4 boundaries
- 01Pauseawaiting_human event
- 02Inspectoperator sees current screen
- 03Decideapprove, reject, or input
- 04Resumeautomation continues
Some steps need a person: a captcha, a one-time code, a judgment call. When the agent reaches one and on_awaiting_human is pause, the run moves to awaiting_human and emits an awaiting_human event with a reason. A human completes the blocking step (in the same machine session), then you hand control back with POST /v1/runs/{id}/resume and an optional note. Resume is only valid while the status is awaiting_human.
import os, requests
BASE = "https://coasty.ai/v1"
HEADERS = {"X-API-Key": os.environ["COASTY_API_KEY"]}
run_id = "7a1b2c3d-4e5f-4678-9abc-def012345678"
run = requests.get(f"{BASE}/runs/{run_id}", headers=HEADERS, timeout=30).json()
# resume is only valid while status == "awaiting_human".
if run["status"] == "awaiting_human":
print("paused:", run["awaiting_human_reason"])
# ... a human completes the blocking step out of band ...
resumed = requests.post(
f"{BASE}/runs/{run_id}/resume",
headers=HEADERS,
json={"note": "Solved the captcha; continue"},
timeout=30,
).json()
print(resumed["status"]) # back to "running"Detect the pause authoritatively from the run object (
status == awaiting_human with awaiting_human_reason set). The SSE awaiting_human event and run.awaiting_human webhook are low-latency hints, but both are best-effort and may be missed. After resume, the run returns to running and normally emits a resumed event. Set on_awaiting_human to fail or cancel at create time if you would rather the run stop than wait for a human.