DEDUPED Hot AI repos, turned into use cases Get the Monday 5

How to retry agent tasks without running them twice with Harnessrouter

Reuse one Idempotency-Key so a retried request returns the first result instead of a new execution.

Who it is forA backend developer whose network calls to agent tasks sometimes time out and get retried.

The problemA retried request can start the same agent task again, which wastes model spend and can repeat side effects.

The outcomeBoth requests return the same response id, and the session contains one turn.

What you need first

  • 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

Steps

  1. Complete the first use case so the API key and base URL are set
  2. Run IDEMPOTENCY_KEY=$(python3 -c 'import uuid; print(uuid.uuid4())') to create one key for the logical request
  3. Send the same POST to /v1/responses twice with the header Idempotency-Key set to that value
  4. Compare the two returned id values
  5. Use a new key for each new logical request and do not reuse a key with a different body

Prompt for your agent

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.

Caveat. Changing only the stream value still counts as the same request, so a retry that changes stream will return the first result.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for HarnessRouter/harnessrouter and "Retry agent tasks without running them twice"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer