# Workers ## Create a worker `$ handinger workers create` **post** `/api/workers` Create a new agent worker and start it with the supplied instruction. ### Parameters - `--input: string` - `--budget: optional "low" or "standard" or "high" or "unlimited"` - `--stream: optional boolean` ### Returns - `worker: object { id, created_at, error, 12 more }` - `id: string` - `created_at: number` - `error: unknown` - `files: array of object { filename, mediaType, url }` - `filename: string` - `mediaType: string` - `url: string` - `incomplete_details: unknown` - `messages: array of unknown` - `metadata: map[unknown]` - `object: "worker"` - `"worker"` - `output: array of object { id, content, role, 2 more }` - `id: string` - `content: array of object { text, type }` - `text: string` - `type: "output_text"` - `"output_text"` - `role: "assistant"` - `"assistant"` - `status: "completed"` - `"completed"` - `type: "message"` - `"message"` - `output_text: string` - `running: boolean` - `sources: array of object { id, title, type, url }` - `id: string` - `title: string` - `type: "url"` - `"url"` - `url: string` - `status: "running" or "completed" or "pending"` - `"running"` - `"completed"` - `"pending"` - `costs: optional object { internalCostUsd, modelCostUsd, sandboxCostUsd, toolCostUsd }` - `internalCostUsd: number` - `modelCostUsd: number` - `sandboxCostUsd: number` - `toolCostUsd: number` - `usage: optional object { cacheReadTokens, cacheWriteTokens, costUsd, 6 more }` - `cacheReadTokens: number` - `cacheWriteTokens: number` - `costUsd: number` - `inputTokens: number` - `outputTokens: number` - `reasoningTokens: number` - `steps: number` - `totalTokens: number` - `credits: optional number` ### Example ```cli handinger workers create \ --api-key 'My API Key' \ --input x ``` #### Response ```json { "id": "id", "created_at": 0, "error": null, "files": [ { "filename": "filename", "mediaType": "mediaType", "url": "url" } ], "incomplete_details": null, "messages": [ {} ], "metadata": { "foo": "bar" }, "object": "worker", "output": [ { "id": "id", "content": [ { "text": "text", "type": "output_text" } ], "role": "assistant", "status": "completed", "type": "message" } ], "output_text": "output_text", "running": true, "sources": [ { "id": "id", "title": "title", "type": "url", "url": "url" } ], "status": "running", "costs": { "internalCostUsd": 0, "modelCostUsd": 0, "sandboxCostUsd": 0, "toolCostUsd": 0 }, "usage": { "cacheReadTokens": 0, "cacheWriteTokens": 0, "costUsd": 0, "inputTokens": 0, "outputTokens": 0, "reasoningTokens": 0, "steps": 0, "totalTokens": 0, "credits": 0 } } ``` ## Retrieve a worker `$ handinger workers retrieve` **get** `/api/workers/{workerId}` Retrieve the current worker state. Pass stream=true or request text/event-stream to subscribe to updates. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. - `--stream: optional boolean` Return a server-sent event stream instead of JSON. ### Returns - `worker: object { id, created_at, error, 12 more }` - `id: string` - `created_at: number` - `error: unknown` - `files: array of object { filename, mediaType, url }` - `filename: string` - `mediaType: string` - `url: string` - `incomplete_details: unknown` - `messages: array of unknown` - `metadata: map[unknown]` - `object: "worker"` - `"worker"` - `output: array of object { id, content, role, 2 more }` - `id: string` - `content: array of object { text, type }` - `text: string` - `type: "output_text"` - `"output_text"` - `role: "assistant"` - `"assistant"` - `status: "completed"` - `"completed"` - `type: "message"` - `"message"` - `output_text: string` - `running: boolean` - `sources: array of object { id, title, type, url }` - `id: string` - `title: string` - `type: "url"` - `"url"` - `url: string` - `status: "running" or "completed" or "pending"` - `"running"` - `"completed"` - `"pending"` - `costs: optional object { internalCostUsd, modelCostUsd, sandboxCostUsd, toolCostUsd }` - `internalCostUsd: number` - `modelCostUsd: number` - `sandboxCostUsd: number` - `toolCostUsd: number` - `usage: optional object { cacheReadTokens, cacheWriteTokens, costUsd, 6 more }` - `cacheReadTokens: number` - `cacheWriteTokens: number` - `costUsd: number` - `inputTokens: number` - `outputTokens: number` - `reasoningTokens: number` - `steps: number` - `totalTokens: number` - `credits: optional number` ### Example ```cli handinger workers retrieve \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM ``` #### Response ```json { "id": "id", "created_at": 0, "error": null, "files": [ { "filename": "filename", "mediaType": "mediaType", "url": "url" } ], "incomplete_details": null, "messages": [ {} ], "metadata": { "foo": "bar" }, "object": "worker", "output": [ { "id": "id", "content": [ { "text": "text", "type": "output_text" } ], "role": "assistant", "status": "completed", "type": "message" } ], "output_text": "output_text", "running": true, "sources": [ { "id": "id", "title": "title", "type": "url", "url": "url" } ], "status": "running", "costs": { "internalCostUsd": 0, "modelCostUsd": 0, "sandboxCostUsd": 0, "toolCostUsd": 0 }, "usage": { "cacheReadTokens": 0, "cacheWriteTokens": 0, "costUsd": 0, "inputTokens": 0, "outputTokens": 0, "reasoningTokens": 0, "steps": 0, "totalTokens": 0, "credits": 0 } } ``` ## Continue a worker `$ handinger workers continue` **post** `/api/workers/{workerId}` Send another instruction to an existing worker. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. - `--input: string` - `--budget: optional "low" or "standard" or "high" or "unlimited"` - `--stream: optional boolean` ### Returns - `worker: object { id, created_at, error, 12 more }` - `id: string` - `created_at: number` - `error: unknown` - `files: array of object { filename, mediaType, url }` - `filename: string` - `mediaType: string` - `url: string` - `incomplete_details: unknown` - `messages: array of unknown` - `metadata: map[unknown]` - `object: "worker"` - `"worker"` - `output: array of object { id, content, role, 2 more }` - `id: string` - `content: array of object { text, type }` - `text: string` - `type: "output_text"` - `"output_text"` - `role: "assistant"` - `"assistant"` - `status: "completed"` - `"completed"` - `type: "message"` - `"message"` - `output_text: string` - `running: boolean` - `sources: array of object { id, title, type, url }` - `id: string` - `title: string` - `type: "url"` - `"url"` - `url: string` - `status: "running" or "completed" or "pending"` - `"running"` - `"completed"` - `"pending"` - `costs: optional object { internalCostUsd, modelCostUsd, sandboxCostUsd, toolCostUsd }` - `internalCostUsd: number` - `modelCostUsd: number` - `sandboxCostUsd: number` - `toolCostUsd: number` - `usage: optional object { cacheReadTokens, cacheWriteTokens, costUsd, 6 more }` - `cacheReadTokens: number` - `cacheWriteTokens: number` - `costUsd: number` - `inputTokens: number` - `outputTokens: number` - `reasoningTokens: number` - `steps: number` - `totalTokens: number` - `credits: optional number` ### Example ```cli handinger workers continue \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM \ --input x ``` #### Response ```json { "id": "id", "created_at": 0, "error": null, "files": [ { "filename": "filename", "mediaType": "mediaType", "url": "url" } ], "incomplete_details": null, "messages": [ {} ], "metadata": { "foo": "bar" }, "object": "worker", "output": [ { "id": "id", "content": [ { "text": "text", "type": "output_text" } ], "role": "assistant", "status": "completed", "type": "message" } ], "output_text": "output_text", "running": true, "sources": [ { "id": "id", "title": "title", "type": "url", "url": "url" } ], "status": "running", "costs": { "internalCostUsd": 0, "modelCostUsd": 0, "sandboxCostUsd": 0, "toolCostUsd": 0 }, "usage": { "cacheReadTokens": 0, "cacheWriteTokens": 0, "costUsd": 0, "inputTokens": 0, "outputTokens": 0, "reasoningTokens": 0, "steps": 0, "totalTokens": 0, "credits": 0 } } ``` ## Stream worker updates `$ handinger workers stream-updates` **get** `/api/workers/{workerId}/stream` Subscribe to a worker using server-sent events. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. ### Returns - `unnamed_schema_1: string` ### Example ```cli handinger workers stream-updates \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM ``` ## Retrieve a worker email address `$ handinger workers retrieve-email` **get** `/api/workers/{workerId}/email` Retrieve the inbound email address for a worker. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. ### Returns - `WorkerEmail: string` ### Example ```cli handinger workers retrieve-email \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM ``` #### Response ```json "string" ``` ## Retrieve a worker file `$ handinger workers retrieve-file` **get** `/api/workers/{workerId}/files/{filePath}` Retrieve a file published from a worker workspace. The runtime route accepts nested paths after /files/. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. - `--file-path: string` Workspace file path after /files. URL-encode slashes for nested paths. ### Returns - `unnamed_schema_0: file path` ### Example ```cli handinger workers retrieve-file \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM \ --file-path scratchpad/plan.md ``` ## Domain Types ### Create Worker - `create_worker: object { input, budget, stream }` - `input: string` - `budget: optional "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `stream: optional boolean` ### Worker - `worker: object { id, created_at, error, 12 more }` - `id: string` - `created_at: number` - `error: unknown` - `files: array of object { filename, mediaType, url }` - `filename: string` - `mediaType: string` - `url: string` - `incomplete_details: unknown` - `messages: array of unknown` - `metadata: map[unknown]` - `object: "worker"` - `"worker"` - `output: array of object { id, content, role, 2 more }` - `id: string` - `content: array of object { text, type }` - `text: string` - `type: "output_text"` - `"output_text"` - `role: "assistant"` - `"assistant"` - `status: "completed"` - `"completed"` - `type: "message"` - `"message"` - `output_text: string` - `running: boolean` - `sources: array of object { id, title, type, url }` - `id: string` - `title: string` - `type: "url"` - `"url"` - `url: string` - `status: "running" or "completed" or "pending"` - `"running"` - `"completed"` - `"pending"` - `costs: optional object { internalCostUsd, modelCostUsd, sandboxCostUsd, toolCostUsd }` - `internalCostUsd: number` - `modelCostUsd: number` - `sandboxCostUsd: number` - `toolCostUsd: number` - `usage: optional object { cacheReadTokens, cacheWriteTokens, costUsd, 6 more }` - `cacheReadTokens: number` - `cacheWriteTokens: number` - `costUsd: number` - `inputTokens: number` - `outputTokens: number` - `reasoningTokens: number` - `steps: number` - `totalTokens: number` - `credits: optional number` # Schedules ## List worker schedules `$ handinger workers:schedules list` **get** `/api/workers/{workerId}/schedules` List scheduled tasks for a worker. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. ### Returns - `WorkerScheduleListResponse: object { schedules, workerId }` - `schedules: array of WorkerSchedule` - `union_member_0: object { id, budget, input, 2 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `input: string` - `nextRunAt: string` - `type: "scheduled"` - `"scheduled"` - `union_member_1: object { id, budget, delayInSeconds, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `delayInSeconds: number` - `input: string` - `nextRunAt: string` - `type: "delayed"` - `"delayed"` - `union_member_2: object { id, budget, cron, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `cron: string` - `input: string` - `nextRunAt: string` - `type: "cron"` - `"cron"` - `union_member_3: object { id, budget, input, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `input: string` - `intervalSeconds: number` - `nextRunAt: string` - `type: "interval"` - `"interval"` - `workerId: string` ### Example ```cli handinger workers:schedules list \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM ``` #### Response ```json { "schedules": [ { "id": "id", "budget": "low", "input": "input", "nextRunAt": "2019-12-27T18:11:19.117Z", "type": "scheduled" } ], "workerId": "workerId" } ``` ## Create a worker schedule `$ handinger workers:schedules create` **post** `/api/workers/{workerId}/schedules` Schedule a worker instruction for a future or recurring run. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. - `--input: string` - `--when: object { date, type } or object { delayInSeconds, type } or object { cron, type } or object { intervalSeconds, type }` - `--budget: optional "low" or "standard" or "high" or "unlimited"` ### Returns - `worker_schedule: object { id, budget, input, 2 more } or object { id, budget, delayInSeconds, 3 more } or object { id, budget, cron, 3 more } or object { id, budget, input, 3 more }` - `union_member_0: object { id, budget, input, 2 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `input: string` - `nextRunAt: string` - `type: "scheduled"` - `"scheduled"` - `union_member_1: object { id, budget, delayInSeconds, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `delayInSeconds: number` - `input: string` - `nextRunAt: string` - `type: "delayed"` - `"delayed"` - `union_member_2: object { id, budget, cron, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `cron: string` - `input: string` - `nextRunAt: string` - `type: "cron"` - `"cron"` - `union_member_3: object { id, budget, input, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `input: string` - `intervalSeconds: number` - `nextRunAt: string` - `type: "interval"` - `"interval"` ### Example ```cli handinger workers:schedules create \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM \ --input x \ --when "{date: '2019-12-27T18:11:19.117Z', type: scheduled}" ``` #### Response ```json { "id": "id", "budget": "low", "input": "input", "nextRunAt": "2019-12-27T18:11:19.117Z", "type": "scheduled" } ``` ## Cancel a worker schedule `$ handinger workers:schedules cancel` **delete** `/api/workers/{workerId}/schedules/{scheduleId}` Cancel a scheduled task for a worker. ### Parameters - `--worker-id: string` Worker id returned by the create worker endpoint. - `--schedule-id: string` Scheduled task id returned by the create schedule endpoint. ### Returns - `WorkerScheduleCancelResponse: object { cancelled }` - `cancelled: boolean` ### Example ```cli handinger workers:schedules cancel \ --api-key 'My API Key' \ --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM \ --schedule-id sch_01HZY31W2SZJ8MJ2FQTR3M1K9D ``` #### Response ```json { "cancelled": true } ``` ## Domain Types ### Worker Schedule - `worker_schedule: object { id, budget, input, 2 more } or object { id, budget, delayInSeconds, 3 more } or object { id, budget, cron, 3 more } or object { id, budget, input, 3 more }` - `union_member_0: object { id, budget, input, 2 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `input: string` - `nextRunAt: string` - `type: "scheduled"` - `"scheduled"` - `union_member_1: object { id, budget, delayInSeconds, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `delayInSeconds: number` - `input: string` - `nextRunAt: string` - `type: "delayed"` - `"delayed"` - `union_member_2: object { id, budget, cron, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `cron: string` - `input: string` - `nextRunAt: string` - `type: "cron"` - `"cron"` - `union_member_3: object { id, budget, input, 3 more }` - `id: string` - `budget: "low" or "standard" or "high" or "unlimited"` - `"low"` - `"standard"` - `"high"` - `"unlimited"` - `input: string` - `intervalSeconds: number` - `nextRunAt: string` - `type: "interval"` - `"interval"`