{
 "schema": "aiblocks-page/1",
 "id": "the-job-queue-where-agents-actually-run-implementation-planner",
 "type": "skill",
 "name": "Recoverable agent job queue builder",
 "summary": "Plan an AI agent job queue that survives crashes, with no repeated paid work, capped retries, lost-job recovery and a safe path for failed jobs.",
 "headline": "Recoverable agent job queue builder",
 "subhead": "Give it your job record, your Redis set-up, the list of agents that take jobs and your retry rules. It plans the queue worker, the start-up recovery and the path for jobs that keep failing. You get code changes to review and test cases, not a running queue.",
 "job": {
  "id": "build-software",
  "name": "Build and ship software"
 },
 "level": "intermediate",
 "thinking": "medium",
 "tested": true,
 "updated": "2026-11-03",
 "first_published": "2026-10-25",
 "inputs": [
  {
   "type": "question",
   "required": true,
   "label": "Question",
   "what": "the problem, decision or piece of work you want help with, and what a good outcome looks like"
  },
  {
   "type": "codebase",
   "required": false,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  }
 ],
 "outputs": [
  {
   "type": "plan",
   "required": true,
   "label": "Plan",
   "what": "a dated plan: what to do, in what order, with a decision rule for each step"
  },
  {
   "type": "code_change",
   "required": false,
   "label": "Code change",
   "what": "a change to the code, with what it fixes and how it was checked"
  }
 ],
 "you_give": [
  "Your job record, meaning the table or type that holds one job (ID, agent, status, input, cost, error, tries)",
  "Which Redis service you use and whether it needs TLS (not the address or password)",
  "The list of agents or job types the worker should run",
  "Your retry rules, such as how many tries and how long to wait",
  "Your spend caps per agent or per day (optional)",
  "Your longest job time and jobs per hour (optional)"
 ],
 "you_get": [
  "A worker plan with the code changes needed in your files",
  "The job states and who moves a job from one to the next",
  "Start-up recovery steps and a dead-letter path with replay rules",
  "A failure checklist for the 10 most common queue problems",
  "Test cases to run before you rely on it"
 ],
 "use_when": [
  "Jobs sit in \"queued\" forever after a Redis restart or a deploy.",
  "A job ran twice and a paid AI call was charged twice.",
  "You are moving agent work out of a web request and into a background worker.",
  "A failed-jobs list keeps growing and nobody knows which ones are safe to replay."
 ],
 "skip_when": [
  "Your queue works and you only want alerts. Use the Agent anomaly monitor builder instead.",
  "You want to cap AI spend, not run jobs. Use the Agent spending cap builder instead.",
  "You can't run Redis. Use a managed queue service from your host and ask this skill only for the job record and recovery ideas.",
  "You want a single task run by one agent with no queue. Use the Single-task agent heartbeat builder."
 ],
 "output_sample": {
  "input": [
   "Your job record (the table or type that holds one job)",
   "Your Redis service and whether it needs TLS",
   "The agents or job types the worker runs",
   "Your retry rules and spend caps (optional)"
  ],
  "prerequisites": [
   "An AI that can read your code files, or code pasted into the chat",
   "A Redis service and a database you control"
  ],
  "output": [
   {
    "name": "BASIS",
    "contains": "What was read, what was left out and every missing input, with what each gap stops."
   },
   {
    "name": "WORKER PLAN",
    "contains": "Each file to change, what to change and why, from the queue set-up to the spend check."
   },
   {
    "name": "JOB STATES",
    "contains": "The states a job moves through, who moves it and what is saved at each step."
   },
   {
    "name": "RECOVERY AND DEAD-LETTER",
    "contains": "How lost jobs return on start-up, what is kept for failed jobs and when a replay is allowed."
   },
   {
    "name": "FAILURE CHECKLIST",
    "contains": "Ten common queue problems with the likely cause, the first thing to check and the fix."
   },
   {
    "name": "TEST CASES",
    "contains": "Cases such as a lost job, a double add, a worker stopped mid-job and a job that fails every try."
   },
   {
    "name": "NEXT STEP",
    "contains": "The one smallest step to take next, such as adding the job row before queueing."
   }
  ]
 },
 "output_shape": "BASIS\n<what was read>\nMISSING: <each missing input and what it stops>\n\nWORKER PLAN\n<file> | <change> | <why>\n\nJOB STATES\n<state> | <meaning> | <who moves it> | <what is saved>\n\nRECOVERY AND DEAD-LETTER\n<start-up steps, evidence kept, replay rules>\n\nFAILURE CHECKLIST\n<symptom> | <likely cause> | <first check> | <fix>\n\nTEST CASES\n<name> | <set-up> | <expected result>\n\nNEXT STEP\n<the smallest useful thing to do now>",
 "how_to_use": [
  "Open the skill in an AI that can read your code, such as Claude Code or Codex. A plain chat works if you paste the files in.",
  "Paste your job record and your list of agents. Say which Redis service you use and whether it needs TLS. Never paste the Redis address, a password or a key.",
  "Add your retry rules and spend caps. If you skip them, the plan marks them MISSING and denies jobs with no cap.",
  "Read WORKER PLAN first. Check that each change names a file in your project.",
  "Run the test cases in your own project. This skill never runs code.",
  "Keep the start-up test jobs out of production."
 ],
 "checks": [],
 "next": [
  {
   "name": "Expo React Native data fetching coder",
   "url": "https://useaiblocks.com/skills/mobile-data-fetching-coder",
   "why": "Build it"
  }
 ],
 "source": null,
 "credits": [],
 "files": [
  "references/method-notes.md",
  "references/visual-reference-notes.md",
  "references/worker-bootstrap-starter.ts"
 ],
 "links": {
  "page": "https://useaiblocks.com/skills/the-job-queue-where-agents-actually-run-implementation-planner",
  "markdown": "https://useaiblocks.com/skills/the-job-queue-where-agents-actually-run-implementation-planner.md",
  "json": "https://useaiblocks.com/skills/the-job-queue-where-agents-actually-run-implementation-planner.json",
  "instructions": "https://useaiblocks.com/skills/the-job-queue-where-agents-actually-run-implementation-planner/SKILL.md",
  "download": "https://useaiblocks.com/skills/the-job-queue-where-agents-actually-run-implementation-planner.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/the-job-queue-where-agents-actually-run-implementation-planner",
  "api_document": "https://useaiblocks.com/api/v1/documents/skill/the-job-queue-where-agents-actually-run-implementation-planner",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
