Agents In Use
What’s new todayLast update
108 use cases added today

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.

Source published dev.toAgent: Claudevia Claude Sonnet
OUR ADAPTATION

Suggested prompt

Suggested prompt written by Agents In Use, not the source author. 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.

Evidence at a glance

Sourced account
Source author
riversea
Original account
Read the source ↗
Published
Source link checked
Reported result
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.
Human involvement
The author changed the pipeline and reported billing results; the post does not describe human review of generated summaries.

A linked account supports attribution. It does not mean we independently reproduced its result.

Report an issue with this caseOpen correction email

Opens your email app with the case link included. Nothing is sent automatically.

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.

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

Added to Agents In Use

Source checked

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.