Agents In Use
What’s new todayLast update
499 additions

How to use Claude to resume report pipelines

The author reports the Anthropic bill fell from $312 to $156 after checkpointing, cached summaries, and compensating actions were added. A simultaneous-run race remained unresolved.

Added dev.toAgent: Claudevia Claude Sonnet
TRY A BOUNDED VERSION

Prompt to try

Editorial adaptation, not the source author’s exact prompt. Replace bracketed inputs and review tool permissions first.

Summarize [advertiser data] for [report run]. Before calling Claude, inspect [checkpoint record] and reuse [cached summary] if summarization is complete. Record each output reference and use [rollback policy] for reversible writes after failure.

What happened

The author reports the Anthropic bill fell from $312 to $156 after checkpointing, cached summaries, and compensating actions were added. A simultaneous-run race remained unresolved.

Reported by riversea on dev.to

How the agent did it

  1. Created a pipeline_runs row at the start of each run.
  2. Recorded step completion and output references after successful steps.
  3. Added rollback that deleted written R2 files and D1 rows.

Where a person stepped in

The author changed the pipeline and reported billing results; the post does not describe human review of generated summaries.

A person set the goal and reviewed the result.

An ad analytics SaaS used Claude Sonnet to summarize raw advertiser data in the second step of a five-step pipeline. Failures later in the pipeline triggered full restarts, repeating model calls and storage writes. The author reported duplicated files, database rows, and an advertiser receiving the same report twice after a Slack webhook failed.

They changed the workflow to create a pipeline_runs row at the beginning of each run. After each successful step, it recorded a completion checkpoint and the actual output reference, such as an R2 key or D1 row ID. A rollback function read those references, deleted written files and rows, and marked the run rolled_back. On retry, the agent checked for an existing in-progress run and reused a cached summary when the summarization step was already complete.

The author reported an Anthropic invoice falling from $312 to $156 after the architectural change. They distinguished storage idempotency from inference caching: avoiding duplicate writes alone did not stop repeat model spending. They also acknowledged an unresolved race between simultaneous runs for one advertiser and uncertainty around irreversible actions.

Who it's for: Developers operating multi-step reporting workflows where retries can repeat both model calls and external writes.

Prompt
Suggested prompt (written by Agents In Use, not the author's)

Source: dev.to · riversea

Frequently asked questions

Why were summaries cached?

Restarting after later failures repeated Claude calls. The retry code reused existingRun.cached_summary when step_completed was at least two.

What problems remained unresolved?

The author described a race when two runs started for the same advertiser and no clean answer for irreversible actions such as sent emails or processed payments.

More details

Remaining steps

  1. Reused cached summaries on retries when the summary step was complete.

About this account

Claude supplied summaries; the surrounding pipeline tracked completion and reused model output during retries.

Platform: dev.to. Attribution: https://dev.to/riversea/60-of-my-312-anthropic-bill-came-from-one-missing-pattern-compensating-actions-4di. Prompt: Suggested (written by Agents In Use, not the author's). Sourced by the Agents In Use pipeline.

Credit: riversea on dev.to

Source published 24 Jun 2026

Source checked 14 Oct 2026

Tools and topics

Claude Sonnet · Cloudflare R2 · Cloudflare D1 · Slack webhook

Checkpointing · Report pipelines · Inference caching

Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.