Skip to main content

talonic_claim_agent_task

Claim a task before processing. A successful claim returns the full payload plus a new execution_epoch and lease_expires_at; both prevent two agents from writing results for the same task.

The claim is the concurrency boundary of the Agent-task workflow. Listing and fetching are read-only and race-free; the moment real work starts, exactly one actor must own the task. The lease makes ownership crash-safe — if the claimant dies, the lease simply expires and the task becomes reclaimable — while the epoch makes ownership unambiguous: whichever claim is newest wins, and everything an older claimant tries to write afterwards is rejected.

ParameterTypeDescription
task_id *UUIDAvailable task to claim, or an expired claim to reclaim.
Tool input and response (payload fields elided)
// talonic_claim_agent_task({ "task_id": "11111111-1111-4111-8111-111111111111" })
{
  "id": "11111111-1111-4111-8111-111111111111",
  "status": "claimed",
  "execution_epoch": 2,
  "claimed_at": "2026-08-29T10:00:00.000Z",
  "lease_expires_at": "2026-08-29T10:10:00.000Z",
  "input_snapshot": { "...": "full payload, same shape as talonic_get_agent_task" },
  "output_contract": [{ "key": "risk_score", "dataType": "number", "required": true }],
  "instructions": "Assess supplier risk from the supplied evidence."
}
A live claim held by another actor returns HTTP 409. Do not retry in a tight loop. Select another available task or wait until the lease expires.

Save the returned execution_epoch. Every heartbeat and submit must echo that exact epoch. Reclaiming an expired lease increments it, permanently invalidating work from the earlier claimant.

Because a successful claim returns the complete payload, a worker that goes straight from the list to a claim never needs a separate talonic_get_agent_task call — inspect-then-claim is for when you want to read before committing, claim-directly is for when the worklist row is enough. After claiming, do the work, heartbeat if the lease is running short, and finish with a single talonic_submit_agent_task call.

Frequently asked questions

What is an execution epoch?+
It is the claim generation. Each successful claim or reclaim receives a new integer; stale epochs are rejected so an expired worker cannot overwrite a newer worker's result.
Can I claim a task that is already claimed?+
Only once its lease has expired. A live claim by another actor returns HTTP 409; after lease_expires_at passes without a heartbeat, the same claim call succeeds as a reclaim and increments the execution epoch.
What happens if I claim a task and never finish it?+
Nothing is written. The lease expires, the task becomes reclaimable, and if timeout_at passes with no submission the stage's timeout_fallthrough policy (hold, skip, or route_to_review) decides what happens to the document. Abandoning a claim never corrupts data — it only delays the document.