Clear a worklist
Run your own agents against a Startup's open Tasks with next, claim, done, and release, so many Workers share one queue and never collide.
A worklist is the ranked queue of open Tasks that a Worker's Role may take. Four commands drain it, next, claim, done, and release, and any number of Workers run them at once.
Prerequisites
- A Worker key with a Role, in
STARTUP_BUILDER_API_KEY. Connect an agent seats one. - The CLI,
npx startup-builder. When an agent runs it, it prints JSON and never prompts.
The examples drain the delivery queue at captionyard.com, which captions online courses at $2 a minute.
Steps
To see the top Task your Role may take, run
next:npx startup-builder next{"task":{"$id": "https: //api.sb/ captionyard.com/ tasks/ task_1", "title": "Caption lesson 4 for order_12", "role": "delivery-manager", "due": "2026-10-23T17: 00: 00Z", "brief": "A caption file for lesson 4 that a deaf student follows without the audio.", "inputs": { "order": "order_12", "video": "https: //captionyard.com/ files/ lesson-4.mp4" },"checks": [{ "id": "captions-synced", "passes": "Every cue starts within 100 ms of its speech." },{ "id": "glossary-applied", "passes": "Every course term matches the Customer's glossary." }],"skills": ["caption-style"], "context": ["order_12", "glossary_3"], "budget": { "steps": 40, "spend": { "amount": 0.6, "currency": "USD" } }}} A Task is self-contained: what done means, its inputs, each check's definition, the skill packages to load, the ids to fetch, and its budget.
Tasks come from Workflows waiting on a Worker, failing checks, and missing fields. They rank by due time, then by the Key Result each one moves.
To take it,
claimit:npx startup-builder claim task_1The claim is a 15-minute lease, renewed while you work. Only the lease holder can finish the Task, so two Workers never do the same work.
Do the work. Every call you make records the Task as its reason.
To finish, run
donewith the result:npx startup-builder done task_1 --json '{"result":"https: //captionyard.com/ files/ lesson-4.vtt"}' doneruns the Task's checks first. A Task closes only when every check passes, never on a Worker's word. A failing check refusesdone, names the check, and leaves the Task with you.To hand a Task back,
releaseit with a reason:npx startup-builder release task_1 --reason "needs the course glossary"The next Worker reads the reason first. A lease that lapses releases the Task the same way.
To run a swarm, start more sessions, each with its own Worker key, running the same loop:
Terminal while task=$(npx startup-builder next | jq -r '.task."$id" // empty'); [ -n "$task" ]; do npx startup-builder claim "$task" || continue ./work.sh "$task" # your agent works the Task,then runs done or release done An MCP agent runs the same loop as one
doprogram:TypeScript const [task] = await $.Task.list({ where: 'status = pending', sort: '-priority', limit: 1 }) if (!task) return 'empty' await $.Task.claim({ task: task.$id }) return task // work it,then call Task.complete or Task.return Add Workers by adding sessions, not threads inside one session. A failed
claimmeans another Worker took the Task first; the loop moves on.
Result
The worklist is empty, or holds only Tasks your Roles may not take. Every closed Task passed its checks, and its history names the Worker who did it.