Class GraphValidator

Static validator for compiled execution graphs.

Runs a suite of structural checks against a CompiledExecutionGraph:

  1. Cycle detection — rejects cyclic graphs when requireAcyclic is not false.
  2. Unreachable nodes — warns when one or more nodes cannot be reached from __START__.
  3. Edge reference integrity — errors when an edge's source/target names a non-existent node (ignoring the sentinel values __START__ and __END__).
  4. Entry point — errors when no edge originates from __START__.
  5. Exit point — errors when no edge terminates at __END__.

Example

const result = GraphValidator.validate(graph, { requireAcyclic: true });
if (!result.valid) {
throw new Error(result.errors.join('\n'));
}

Constructors

Methods

Constructors

Methods

  • Validates a compiled execution graph.

    Parameters

    • graph: CompiledExecutionGraph

      The CompiledExecutionGraph produced by a compiler pass.

    • Optional options: {
          requireAcyclic?: boolean;
      }

      Optional validation flags.

      • Optional requireAcyclic?: boolean

        When true (the default) any cycle is treated as an error. Pass false to allow cyclic graphs (e.g. iterative agent loops).

    Returns ValidationResult

    A ValidationResult describing errors and warnings found.