Recipe catalog / retry-worthwhile
Decide whether to retry
retry-worthwhile is a Jev recipe from the jev-recipes TypeScript package. Does failure describe a transient condition where an identical retry could succeed, given any attempt history? Use it when you need a yes/no decision after a tool call or request fails and the error text, not a status code, is the only signal you have.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use retry-worthwhile in TypeScript?
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { retryWorthwhile } from 'jev-recipes/retry-worthwhile';
const result = await retryWorthwhile({
"failure": "HTTP 429 Too Many Requests: rate limit exceeded for this API key. Retry-After: 30.",
"attempt": "First attempt, issued immediately after a batch of 50 similar calls to the same endpoint.",
"minConfidence": 0.8
});
console.log(result);
What input does retry-worthwhile take?
| Field | Type | Needed |
|---|---|---|
| failure | string | Required |
| attempt | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"failure": {
"type": "string"
},
"attempt": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"failure"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"probability": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"verdict": {
"type": "string",
"enum": [
"retry",
"stop"
]
}
},
"required": [
"model",
"usage",
"status",
"probability",
"confidence",
"verdict"
],
"additionalProperties": false
}
}What does a retry-worthwhile result look like?
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo retry-worthwhile.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"probability": 0.95,
"confidence": 0.95,
"verdict": "retry"
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas. attempt is optional and is omitted from the request when absent.
Result
verdict is retry when Jev's yes probability is at least 0.5 and stop otherwise. probability is that yes probability. confidence is the probability of the chosen side, so a 0.1 yes probability yields stop with 0.9 confidence.
A result is ready when confidence meets minConfidence. Otherwise it is review. Treat a review result as unknown and fall back to your safe default, such as a single bounded retry or surfacing the failure to the user.
Reuse and calls
Uses the shared gate helper, a single yes/no question. This folder owns the question wording, the outcome descriptions, and the review policy. A live invocation makes one logical Jev request.
Limits
The recipe reads the failure as text and asks only whether repeating the same attempt could succeed. It does not know your retry budget, backoff policy, or whether the action is idempotent, and it does not say whether a modified attempt with corrected input or permissions would work. Supply prior attempts in attempt so repeated identical failures lower the answer. Use failure-kind to sort failures into your own categories and repeated-attempt to check that a proposed next try is actually different.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo retry-worthwhile shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe retry-worthwhile to inspect the input and result schemas.
How accurate is retry-worthwhile?
jev-1.13.0 / 2026-10-04 / 60 development cases
Scoring revision 2.
60 ready decisions, with 100% accuracy among those decisions.
95% case-level interval: 94% to 100%. Related synthetic cases are correlated.
This measures the recorded dataset, not general readiness. Label sources: author-synthetic: AI-authored synthetic boundary cases for jev-recipes; labels have not had independent human review.
Use the evaluation guide to measure this decision on your own labeled cases.
What are the limits of retry-worthwhile?
- Judges the failure text as written. It does not know your retry budget, backoff policy, or whether the action is safe to repeat.
- Says whether an identical retry could succeed, not whether a modified attempt would. Fixing inputs or permissions is a different decision.
Which recipes are related to retry-worthwhile?
- failure-kind: Use failure-kind to place the failure in one of your own categories when you need more than a retry or stop answer.
- repeated-attempt: Use repeated-attempt to check whether a proposed next attempt is really a fresh approach rather than the same one again.