My Morning Batch Was Missing the Prompt Cache Every Time — Warming Cadence and the Break-Even Math for the 1-Hour TTL
Jobs that run a few hours apart cold-miss the prompt cache even with a 1-hour TTL. Here is how to back out the right warming interval from the TTL, and how to write the break-even formula that decides whether warming pays off — with numbers from a four-site daily generation pipeline.
Claude API Streaming Breaks the "Everything Arrives" Assumption — Field Notes on Recovering from Partial Failure
Once concurrency climbs, Claude API streams disconnect mid-response, replay events, and emit half-finished tool arguments. Treating partial failure as the norm rather than an anomaly, here is how I rebuilt the implementation and monitoring to recover quietly.
Surviving the 90-Second Code Execution Cell Limit with Checkpointed Chunking
Claude's code execution tool now enforces a 90-second per-cell limit. Here is how to keep a long batch from getting cut off there: persist progress to the container filesystem and resume across cells, with working code for timing, idempotent checkpoints, and knowing when to offload.
Don't Carry Search Results Twice: Trimming Consumed Blocks with response_inclusion
When an agent runs dynamic filtering, output tokens balloon because the raw search-result blocks a code execution call already consumed get echoed back into the response. Here is when response_inclusion: excluded is safe to use, when you must keep full, with implementation and a decision table.
When Your Claude × Playwright Browser Agent Fails While Reporting Success — Verifying Actions and Catching UI Drift
A vision-driven Claude + Playwright browser agent fails quietly: it reports success while nothing actually changed. Here is how to stop trusting self-reports, verify each action against the goal, and detect UI drift before it breaks you.
When Your Claude API Response Cache Returns Stale Answers and Near-Miss Wrong Ones — Field Notes on Freshness and False-Hit Suppression
A Claude API response cache improves latency and cost immediately, but the problems that hurt in production are not average hit rate — they are stale hits and semantic false hits. Here is the key design, freshness management, false-hit suppression, and observability that keep a cache honest.
PII Masking for Claude API Lives or Dies on the Ledger — Restore, Encrypt, Measure
The hard part of masking PII before Claude API isn't detection — it's operating the token ledger you restore from. Encrypted storage, multi-instance sharing, and a daily leak-rate loop, with working code.
When a Model Disappears Without Warning: A State Machine for Retirement, Withdrawal, and Overload
A model can become unusable in hours for reasons that have nothing to do with a technical outage. This guide models three distinct flavors of 'unavailable'—retirement, withdrawal, and transient overload—as one availability state machine, with a router that keeps automated pipelines running. Working TypeScript and Python included.
Managed Agents Adds Scheduled Deploys, a Vault, and Session Webhooks — Deciding What Leaves My Cron Setup
Scheduled deploys, vault credentials, and session-thread webhooks just landed in Claude Managed Agents. How I triaged my self-hosted cron jobs: what moves, what stays, and why idempotency decides.
Handing Monthly Revenue CSVs to the Claude API Code Execution Tool — Files API Wiring, Container Reuse, and Billing Traps
How I moved monthly revenue-CSV reconciliation for four apps into the Claude API Code Execution tool — Files API integration, container reuse, the 5-minute billing minimum, and the file-preload charge that surprises almost everyone.
An Anti-Corruption Layer for Claude API Models — Keeping Generation Changes Out of Your Business Logic
Hard-coding model strings into business logic means production breaks quietly every time a generation is retired. Here is an anti-corruption layer that separates logical roles from physical model IDs, with working TypeScript and Python, migration costs, and the judgment calls behind it.
Diagnosing invalid_request_error When You Pass an Image URL to the Claude API
When the Claude API rejects an image you passed via `source.type: url`, the root cause almost always lives in one of four buckets: scheme, MIME, size, or reachability. Here is the diagnostic order I use in production.