Poll for queued work
Atomically pops and pre-claims work items from the priority queue (ZPOPMIN). Also returns inbox messages for the worker's active sessions. Workers that receive `preClaimed: true` must NOT make a separate claim call. Runtime-JWT callers also receive `gitCredentials` (short-lived GitHub PAT) and optionally `batchWork` (code-survival scan items, gated on the `code-survival-scan` capability).
Authorization
workerJwt Runtime JWT minted by the platform at worker registration. Three-segment dotted string. Claims include {jti, proj, org, sub (=workerId), reg, scope[]}. Use on all post-registration worker endpoints.
In: header
Path Parameters
Worker ID (must match the sub claim of the runtime JWT).
Response Body
application/json
application/json
application/json
curl -X GET "https://example.com/api/workers/string/poll"{
"work": [
{
"sessionId": "string",
"issueId": "string",
"issueIdentifier": "string",
"priority": 0,
"queuedAt": 0,
"prompt": "string",
"providerSessionId": "string",
"workType": "research",
"sourceSessionId": "string",
"projectName": "string",
"repository": "string",
"kits": {}
}
],
"inboxMessages": {
"property1": [
{
"id": "string",
"type": "stop",
"sessionId": "string",
"payload": "string",
"userId": "string",
"userName": "string",
"createdAt": 0,
"lane": "urgent"
}
],
"property2": [
{
"id": "string",
"type": "stop",
"sessionId": "string",
"payload": "string",
"userId": "string",
"userName": "string",
"createdAt": 0,
"lane": "urgent"
}
]
},
"hasInboxMessages": true,
"preClaimed": true,
"claimedSessionIds": [
"string"
],
"gitCredentials": [
{
"token": "string",
"cloneUrl": "string",
"expiresAt": "2019-08-24T14:15:22Z"
}
],
"batchWork": [
{}
]
}{
"error": "Session not found"
}{
"error": "Session not found"
}AF-compatible worker registration
AF-compatible registration endpoint. Accepts three auth modes: 1. `Authorization: Bearer rsk_live_*` or `rsp_live_*` (registration token in header). 2. Legacy `WORKER_API_KEY` (transitional; being removed). 3. User session cookie / `rsk_` API key with `projectId` in body (new-user onboarding). Returns a `runtimeToken` (and `runtimeTokenExpiresAt`) for runtime-JWT-capable callers; legacy callers receive `null` for these fields.
AF-compatible worker heartbeat
Updates `activeCount` on the worker's Redis record and resets its TTL. Returns pending work queue depth.