{
 "schema": "aiblocks-page/1",
 "id": "wakeups-how-agents-alert-each-other-implementation-planner",
 "type": "skill",
 "name": "Agent wakeup and claim recovery builder",
 "summary": "Build an agent wakeup flow with scoped events, duplicate checks, claim leases, retries and recovery.",
 "headline": "Agent wakeup and claim recovery builder",
 "subhead": "Build an agent wakeup flow with scoped events, duplicate checks, claim leases, retries and recovery.",
 "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": "codebase",
   "required": true,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  }
 ],
 "outputs": [
  {
   "type": "code_change",
   "required": true,
   "label": "Code change",
   "what": "a change to the code, with what it fixes and how it was checked"
  }
 ],
 "you_give": [
  "The list of events that should wake an agent",
  "The fields that make two events the same (the dedup key)",
  "How long an agent may hold a claim (the lease length)",
  "Where agent state is stored, and the database and queue you use, such as Postgres or Redis. Your AI can often read these from your code."
 ],
 "you_get": [
  "A bounded wakeup dispatcher with retry and stale-claim recovery",
  "A failure checklist and synthetic test cases"
 ],
 "use_when": [
  "You need a bounded wakeup dispatcher with retry and stale-claim recovery.",
  "You are adding this function to an agent system.",
  "You need to compare an existing version with the supplied starter.",
  "You want a starter to review: the output is not run or tested, so check it before you turn it on."
 ],
 "skip_when": [
  "You need one agent run loop that does a single task per run. Use the Single-task agent heartbeat builder.",
  "You need a job queue that survives crashes and caps retries. Use the Recoverable agent job queue builder.",
  "You need a task table where an agent claims one task at a time. Use the Agent task ownership workflow builder."
 ],
 "output_sample": {
  "input": [
   "Your list of events that should wake an agent (for example, a proposal approved or a task assigned)",
   "The key that marks two events as the same one",
   "How long an agent may hold a claim before it counts as stale",
   "How your agents store their state and pause or budget limits"
  ],
  "prerequisites": [
   "A codebase with an agent system already running a regular heartbeat",
   "Someone who can review and test the code before it goes live"
  ],
  "output": [
   {
    "name": "Wakeup dispatcher",
    "contains": "Draft code that saves one wakeup per event, claims it once, and hands it to the right agent."
   },
   {
    "name": "Duplicate check",
    "contains": "How the dedup key stops the same event from waking an agent twice."
   },
   {
    "name": "Stale-claim recovery",
    "contains": "A rule that puts claims back in the queue when a worker crashes before finishing."
   },
   {
    "name": "Failure checklist",
    "contains": "The ways this can break, such as lost wakeups, event storms and loops, with what to check."
   },
   {
    "name": "Synthetic test cases",
    "contains": "Test cases built from made-up events that cover duplicates, crashes and paused agents."
   }
  ]
 },
 "how_to_use": [
  "Download the complete pack and give its instructions to your AI. Use an AI that can read your code.",
  "Give it your list of events that should wake an agent, the key that marks two events as the same, how long a claim may be held, and how agents store state.",
  "Read the dispatcher against your current heartbeat. The code is a starter, not a finished service.",
  "Run the test cases in a staging project before you turn it on."
 ],
 "checks": [],
 "next": [
  {
   "name": "Slack agent message router builder",
   "url": "https://useaiblocks.com/skills/how-messages-reach-your-agent-implementation-planner",
   "why": "Build it"
  }
 ],
 "source": null,
 "credits": [],
 "files": [
  "references/method-notes.md",
  "references/wakeup-dispatcher-starter.ts"
 ],
 "links": {
  "page": "https://useaiblocks.com/skills/wakeups-how-agents-alert-each-other-implementation-planner",
  "markdown": "https://useaiblocks.com/skills/wakeups-how-agents-alert-each-other-implementation-planner.md",
  "json": "https://useaiblocks.com/skills/wakeups-how-agents-alert-each-other-implementation-planner.json",
  "instructions": "https://useaiblocks.com/skills/wakeups-how-agents-alert-each-other-implementation-planner/SKILL.md",
  "download": "https://useaiblocks.com/skills/wakeups-how-agents-alert-each-other-implementation-planner.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/wakeups-how-agents-alert-each-other-implementation-planner",
  "api_document": "https://useaiblocks.com/api/v1/documents/skill/wakeups-how-agents-alert-each-other-implementation-planner",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
