Recipe catalog / action-compare
Compare two candidate actions
action-compare is a Jev recipe from the jev-recipes TypeScript package. Which of firstAction and secondAction better advances goal within constraints? Use it when an agent has narrowed to two next steps and needs a head-to-head preference under the stated goal and constraints.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use action-compare 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 { actionCompare } from 'jev-recipes/action-compare';
const result = await actionCompare({
"goal": "Find out why the nightly export job failed last night.",
"firstAction": "Open the job's log for last night's run and read the last 200 lines.",
"secondAction": "Re-run the export job now and see if it fails again.",
"constraints": "Do not trigger production jobs during business hours.",
"minConfidence": 0.8
});
console.log(result);
What input does action-compare take?
| Field | Type | Needed |
|---|---|---|
| goal | string | Required |
| firstAction | string | Required |
| secondAction | string | Required |
| constraints | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"goal": {
"type": "string"
},
"firstAction": {
"type": "string"
},
"secondAction": {
"type": "string"
},
"constraints": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"goal",
"firstAction",
"secondAction"
]
},
"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"
]
},
"verdict": {
"type": "string",
"enum": [
"first",
"second",
"tie",
"neither",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"first",
"second",
"tie",
"neither",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"first",
"second",
"tie",
"neither",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}What does a action-compare 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 action-compare.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "first",
"confidence": 0.88,
"probabilities": {
"first": 0.88,
"second": 0.04,
"tie": 0.04,
"neither": 0.02,
"unclear": 0.02
}
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas. constraints is optional and is omitted from the request when absent.
Result
verdict is first, second, tie, neither, or unclear. first and second name the preferred action. tie means both advance the goal about equally. neither means no action advances the goal within the constraints, which usually signals that the agent should replan.
A result is ready when confidence meets minConfidence and the verdict is not unclear. probabilities covers all five outcomes.
Reuse and calls
Uses the shared comparison helper, which fixes the five outcomes and tells Jev that presentation order is irrelevant. This folder owns the question wording and the four outcome descriptions. A live invocation makes one logical Jev request.
Limits
The recipe prefers one described action over another. It does not know the true state of your systems, so an action that sounds right may still fail. Constraints are judged as text; enforce permissions, rate limits, and safety rules in code. For more than two candidates use choose-action.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo action-compare shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe action-compare to inspect the input and result schemas.
How accurate is action-compare?
No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.
Use the evaluation guide to measure this decision on your own labeled cases.
What are the limits of action-compare?
- Compares two described actions. It does not execute, simulate, or authorize either one.
- Constraints are judged as written; permissions and safety rules belong in application code.
Which recipes are related to action-compare?
- choose-action: Use choose-action to select one action from a longer list of candidates.
- action-scope: Use action-scope to check whether a single action stays within the requested work.