timeout seconds (default 25, max 30). Returns immediately when the task transitions to a terminal status. If still pending after the timeout, returns the current status and the client reconnects.
Why long-polling
PlainGET /api/tasks/{id} works for one-shot reads, but agents waiting on tasks need either polling (every second → DB load + latency) or long-polling (one connection, server pushes when state changes). awaithumans uses long-polling because:
- One connection per task, parked at the server
- Server-side detection of terminal transitions (no polling cost)
- Any HTTP client works (no WebSockets / SSE complexity)
Query params
Response
Statuses your client cares about
Errors
Polling vs webhooks
For agents that block onawait_human() long enough that polling cost matters, use the Temporal or LangGraph adapters — they replace polling with workflow signals via the callback_url mechanism.
For everything else (Flask handlers, scripts, simple async loops), polling is fine. The cost: one HTTP connection per pending task, held for ~25s at a time.