Catalog/workflow-level-layering

Workflow

DAG level layering API

Assigns each DAG node the length of its longest dependency chain so nodes in the same layer can run in parallel, returning layers and per-node levels. Answers 'Which steps can run in parallel?', 'How deep is my dependency graph?'.

Price$0.02per request
MethodPOST
Route/v1/workflow/level-layering
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
layeringlevelsdagparallelgraphstagesschedulingworkflow
API URLhttps://x402.hexl.dev/v1/workflow/level-layering
Integration docs
Example request
{
  "nodes": [
    "a",
    "b",
    "c",
    "d"
  ],
  "edges": [
    [
      "a",
      "c"
    ],
    [
      "b",
      "c"
    ],
    [
      "c",
      "d"
    ]
  ]
}
Example response
{
  "layers": [
    [
      "a",
      "b"
    ],
    [
      "c"
    ],
    [
      "d"
    ]
  ],
  "depth": 3,
  "levelOf": {
    "a": 0,
    "b": 0,
    "c": 1,
    "d": 2
  },
  "interpretation": "3 layer(s); nodes in the same layer can run in parallel."
}
Input schema
{
  "type": "object",
  "required": [
    "nodes",
    "edges"
  ],
  "properties": {
    "nodes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "examples": [
        [
          "a",
          "b",
          "c",
          "d"
        ]
      ]
    },
    "edges": {
      "type": "array",
      "examples": [
        [
          [
            "a",
            "c"
          ],
          [
            "b",
            "c"
          ],
          [
            "c",
            "d"
          ]
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}