capabilities.work

Run a Prediction with Bounded Wait and Cancel

A 3-step recipe with Replicate. We can help you get access.

Recipe · 3 steps

Run a Prediction with Bounded Wait and Cancel

with Replicate · Artificial Intelligence Management

Create a prediction, poll within a bounded budget, and cancel it if still running.

  1. Create a prediction for the supplied model version and input.
  2. Retrieve the prediction state, retrying a bounded number of times. If the budget is exhausted while still running, control falls through to the cancel step.
  3. Cancel the prediction because it did not finish within the bounded poll budget, stopping further compute usage.
What you'll need to have ready
  • apiToken: Replicate API token used as a Bearer credential.
  • version: The ID of the model version that you want to run.
  • input: The model's input as a JSON object matching the version's input schema.
For your developer

Arazzo workflow replicate:predict-with-timeout-cancel, 3 operations: predictions.create → predictions.get → predictions.cancel. Specs on APIs.io.