Daily Replicate usage and reliability digest in Slack

By General Input

Every weekday at 7:50am, see how many model runs succeeded, which models are failing, and where your processing time actually went.

Integrations

  • Replicate
  • Slack
  • Google Sheets

Type

Deterministic Code

Categories

  • Engineering
  • Operations

Every weekday at 7:50am, build me a Replicate usage and reliability digest, post it to Slack, and append the day's numbers to a Google Sheet so we accumulate a history we can chart.

Start by pulling every prediction created in the last 24 hours using the Replicate List Predictions operation. This is a paginated list endpoint: it returns an object shaped { results: [...], next: <url|null>, previous: <url|null> }. Follow the full next URL, which carries an opaque cursor query param, to fetch the next page, and stop when next is null. Keep paging until the whole 24 hour window is covered, then filter the collected predictions to those whose created_at falls inside the window. Do not stop at the first page, because a busy account will have many pages and a partial pull would silently understate every number in the digest.

Group the predictions two ways: by model and by status. Replicate status values are starting, processing, succeeded, failed, and canceled. For each model, count total runs and a breakdown of how many succeeded, failed, were canceled, and are still in flight (starting or processing). Sum total predict time per model from each prediction's metrics.predict_time, and also compute the average predict time per run. Some predictions will have no metrics.predict_time, for example ones that failed before the model started or that are still running, so treat a missing value as zero and never let it break the sum.

Define the failure rate as failed divided by the number of finished runs, where finished means succeeded plus failed plus canceled. Predictions still in starting or processing are excluded from the rate and reported separately as a still running count, so an in flight run is never counted as either a success or a failure. Compute this both overall across the account and per model.

Post the digest to a Slack channel using the Send a Message operation. Lead with the two headline numbers: the overall failure rate for the window (with the raw failed and finished counts in parentheses) and the single model that burned the most total predict time, including its second count and run count. Then explicitly call out every model whose failure rate is above 10 percent, listing each one with its failure rate, its failed and finished counts, and its total predict time. Follow that with a per model table showing run counts, the status breakdown, and total predict time, sorted by predict time descending. If no model is above the threshold, say so in one line rather than omitting the section, and if there were no predictions at all in the window, still post a short message saying zero runs were recorded so a quiet day is never confused with a broken workflow.

Then append one row per model per day to a tracking tab in Google Sheets using the Append Values operation. Each row should carry the date of the window, the model identifier, total runs, succeeded, failed, canceled, still running, the failure rate, total predict time in seconds, and average predict time per run. Append only, never overwrite earlier rows, because the whole point is the accumulating history that lets us chart failure rates and predict time per model over weeks.

Keep every number factual. A Replicate prediction object has no cost field, so report run counts and predict time as the spend proxy and never fabricate dollar estimates, per unit pricing, or projected monthly costs. If a figure cannot be computed from the prediction data, leave it out rather than guessing.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageWin back LiveChat visitors whose chats went unansweredLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardChat quality review board for LiveChat support leadsLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seats