claim_task
Claim a task for exclusive processing. Without a task ID, picks the highest-priority claimable task; with a task ID, claims that specific task. Lease duration is configurable.
Instructions
Claim a task for exclusive processing (work-queue semantics). Without task_id, atomically picks the highest-priority claimable task from the queue — open, unclaimed, and unassigned or assigned to you. With task_id, claims that specific task (e.g. one you found via list_tasks, or after a write was rejected with 'claim it first'); fails with a conflict if it is completed, assigned to another agent, or claimed with a live lease. Returns the claimed task, or reports an empty queue. The claim is a lease (default 300 seconds): extend it with heartbeat_task while working, requeue with release_task, or finish with complete_task. Hosted API only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | No | Claim this specific task instead of the next from the queue | |
| project_id | No | Only claim tasks in this project (queue claim only) | |
| labels | No | Only claim tasks carrying all of these labels (queue claim only) | |
| lease_seconds | No | Lease duration in seconds (30-3600, default 300) |