Agent Checkout
The act of an agent claiming exclusive ownership of a task from a shared queue to prevent duplicate execution by multiple agents running concurrently in a multi-agent system.
In systems where multiple agent instances may be running simultaneously, task checkout is the locking mechanism that prevents two agents from starting the same task. The agent atomically transitions a task from PENDING to IN_PROGRESS (its own process ID recorded) before beginning work. Any other agent that tries to claim the same task finds it already checked out and moves on.
Checkout expiry handles the failure case: if an agent crashes after checkout without completing the task, the task remains locked indefinitely unless a timeout releases it. The watchdog or orchestrator should periodically scan for expired checkouts and reset them to PENDING so another agent can pick them up.
Paperclip uses Postgres row-level locking and status fields to implement idempotent checkout. The idempotency principle means a task can be safely retried after a failed checkout: if the initial work was partially done, the agent checks for prior partial results before starting fresh, avoiding redundant work.