{"name":"agent-gateway","description":"HTTP API that runs tasks on a remote Claude Code agent. All /v1 routes need 'Authorization: Bearer <token>'.","auth":"Authorization: Bearer <token>","endpoints":[{"method":"GET","path":"/","auth":false,"desc":"this discovery document"},{"method":"GET","path":"/health","auth":false,"desc":"returns {\"ok\":true}"},{"method":"POST","path":"/v1/tasks","auth":true,"desc":"create a task; returns 202 {task_id}, or the finished task if wait=true and it ends within 120s","body":{"prompt":"string (required)","cwd":"string, relative to workspace root (optional)","session_id":"string, resume a previous session (optional)","permission_mode":"default|acceptEdits|plan (optional)","allowed_tools":"list, subset of Bash,Read,Edit,Write,Glob,Grep (optional)","max_turns":"int (optional)","timeout_s":"int (optional)","wait":"bool (optional)"}},{"method":"GET","path":"/v1/tasks?limit=20","auth":true,"desc":"recent tasks"},{"method":"GET","path":"/v1/tasks/{id}","auth":true,"desc":"status (queued|running|done|failed|cancelled|timeout), result, session_id, cost"},{"method":"GET","path":"/v1/tasks/{id}/events?after=<n>","auth":true,"desc":"incremental stream-json events; poll with after=<next>"},{"method":"GET","path":"/v1/tasks/{id}/stream","auth":true,"desc":"same events as Server-Sent Events"},{"method":"POST","path":"/v1/tasks/{id}/cancel","auth":true,"desc":"kill the task's process tree"}],"workflow":"POST /v1/tasks -> poll GET /v1/tasks/{id} until status is not queued/running -> read 'result'. For a follow-up, POST again with the returned session_id."}