{
 "schema_version": 1,
 "generated": "2026-10-24",
 "id": "harnessrouter-harnessrouter--retry-agent-tasks-without-duplicate-runs",
 "repo": "HarnessRouter/harnessrouter",
 "repo_url": "https://github.com/HarnessRouter/harnessrouter",
 "repo_slug": "harnessrouter-harnessrouter",
 "title": "Retry agent tasks without running them twice",
 "page_title": "How to retry agent tasks without running them twice with Harnessrouter",
 "summary": "Reuse one Idempotency-Key so a retried request returns the first result instead of a new execution.",
 "who": "A backend developer whose network calls to agent tasks sometimes time out and get retried.",
 "problem": "A retried request can start the same agent task again, which wastes model spend and can repeat side effects.",
 "outcome": "Both requests return the same response id, and the session contains one turn.",
 "steps": [
  "Complete the first use case so the API key and base URL are set",
  "Run `IDEMPOTENCY_KEY=$(python3 -c 'import uuid; print(uuid.uuid4())')` to create one key for the logical request",
  "Send the same POST to /v1/responses twice with the header Idempotency-Key set to that value",
  "Compare the two returned id values",
  "Use a new key for each new logical request and do not reuse a key with a different body"
 ],
 "agent_prompt": "Using the HarnessRouter repo at https://github.com/HarnessRouter/harnessrouter, send the same POST to <base-url>/v1/responses twice with one Idempotency-Key header. Expected output: both responses have the same id and the session has one turn. Verify that a second request with the same key but a different body returns 409 before reporting success.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "Changing only the stream value still counts as the same request, so a retry that changes stream will return the first result.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Docker installed",
  "About 4 GB of free disk space",
  "A provider API key for at least one supported model provider",
  "Python 3 if you use the Idempotency-Key example"
 ],
 "risk": "sensitive",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/harnessrouter-harnessrouter/retry-agent-tasks-without-duplicate-runs/",
 "md": "https://dedupedai.com/use-cases/harnessrouter-harnessrouter/retry-agent-tasks-without-duplicate-runs/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/harnessrouter-harnessrouter--retry-agent-tasks-without-duplicate-runs.json",
 "api_version": "v1"
}
