Recipe catalog / task-dependency
Check the dependency between two tasks
Identify whether either of two tasks requires the other to finish before it can start.
You need to decide whether two tasks can run in parallel or require a particular order.
Explore this recipe interactively ยท Source and implementation guide
Use task-dependency 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 { taskDependency } from 'jev-recipes/task-dependency';
const result = await taskDependency({
"firstTask": "Build the release archive from the source code.",
"secondTask": "Upload the completed release archive to the artifact store.",
"context": "The source code is available. No release archive exists yet, and uploading requires the completed archive."
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| firstTask | string | Required |
| secondTask | string | Required |
| context | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"firstTask": {
"type": "string",
"description": "The first task, including its inputs and output when known."
},
"secondTask": {
"type": "string",
"description": "The second task, including its inputs and output when known."
},
"context": {
"type": "string",
"description": "Known prerequisites, available inputs, and relevant workflow conditions."
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"firstTask",
"secondTask"
]
},
"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_before_second",
"second_before_first",
"independent",
"cyclic",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"first_before_second",
"second_before_first",
"independent",
"cyclic",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"first_before_second",
"second_before_first",
"independent",
"cyclic",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}Saved example result
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo task-dependency.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "first_before_second",
"confidence": 0.96,
"probabilities": {
"first_before_second": 0.96,
"second_before_first": 0.01,
"independent": 0.01,
"cyclic": 0.01,
"unclear": 0.01
}
}
Evaluation evidence
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.
Limitations
- Assesses only the supplied pair and prerequisites; does not build or validate a complete dependency graph.
- Independence of prerequisites does not establish that parallel execution is safe: shared resources, locks, permissions, and scheduling remain the caller's responsibility.
Related recipes
- task-duplicate: Use task-duplicate to detect repeated outcomes before scheduling tasks.
- step-complete: Use step-complete to check whether evidence establishes a known prerequisite is already satisfied.