jevrecipes

Recipe catalog / task-dependency

Check the dependency between two tasks

task-dependency is a Jev recipe from the jev-recipes TypeScript package. Identify whether either of two tasks requires the other to finish before it can start. Use it when you need to decide whether two tasks can run in parallel or require a particular order.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I 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);

What input does task-dependency take?

FieldTypeNeeded
firstTaskstringRequired
secondTaskstringRequired
contextstringOptional
minConfidencenumberOptional
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
  }
}

What does a task-dependency 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 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
  }
}

Input

Supply non-empty text for each required field. Optional context must also be non-empty when supplied. minConfidence defaults to 0.8 and accepts values from 0 to 1.

See shared options and behavior for client configuration, validation, and errors.

Result

Verdict Meaning
first_before_second The second task needs the first task to finish, and the first does not need the second to finish.
second_before_first The first task needs the second task to finish, and the second does not need the first to finish.
independent Neither task needs the other to finish before it can start under the supplied conditions.
cyclic Each task requires the other to finish before it can start.
unclear The supplied descriptions do not establish the prerequisite relationship.

The result has status: 'ready' when confidence meets minConfidence and the verdict is not unclear. Otherwise it has status: 'review'. An unclear verdict always requires review, even at high confidence or with a zero threshold. ready describes confidence in the assessment, not approval to act.

Decision boundaries

These cases document the intended decision policy. They are not live model evaluation results.

Supplied situation Intended verdict
Build an archive, then upload that archive when it does not yet exist. first_before_second
Upload a missing archive, paired with the task that builds it. second_before_first
Proofread two separate supplied documents, with both documents available. independent
Each task explicitly requires the other task's completed output before starting. cyclic
Two tasks are mentioned without enough information about their prerequisites. unclear

Reuse

This checks a necessary execution order between two tasks. It does not check completion, pick a tool, or select the next task.

Uses the shared choice helper and makes one logical Jev request. It does not call another recipe or perform application actions.

Limits

How accurate is task-dependency?

Fixture only

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 task-dependency?