Encapsulates an agent graph configuration and its pre-built node collection.

Provides graph-level orchestration including relationship queries (parent/child), breadth-first traversal in both forward and reverse directions, and graph tracker creation.

Obtain an instance via LDAIClient.agentGraph. When the graph is disabled or invalid, the returned instance has enabled set to false and an empty node collection.

Hierarchy

  • AgentGraphDefinition

Constructors

Properties

_createTracker: (() => LDGraphTracker)

Type declaration

_nodes: Record<string, AgentGraphNode>
enabled: boolean

Methods

  • Traverses the graph from terminal nodes up to the root.

    Uses BFS upward via parent edges so that each node is processed only after all of its reachable descendants have been processed. The root is always visited last. Cyclic graphs are handled safely — each node is visited at most once; if the graph has no terminal nodes, this method returns without invoking fn.

    Ordering note: Within a single BFS level (nodes at the same depth from a terminal) the visit order is not strictly guaranteed. The guarantee is only that a node is visited before any of its ancestors — not that siblings at the same depth are visited in a specific order relative to each other.

    The value returned by fn is stored in the mutable executionContext under the node's key.

    Parameters

    • fn: TraversalFn

      Callback invoked for each node. Its return value is added to executionContext keyed by the node's config key.

    • initialExecutionContext: Record<string, unknown> = {}

      Optional initial context to seed the traversal.

    Returns void

  • Traverses the graph breadth-first from the root to all terminal nodes.

    Nodes at the same depth are processed before advancing to the next depth. The value returned by fn is stored in the mutable executionContext under the node's key, making upstream results available to downstream nodes.

    Cyclic graphs are handled safely — each node is visited at most once.

    Parameters

    • fn: TraversalFn

      Callback invoked for each node. Its return value is added to executionContext keyed by the node's config key.

    • initialExecutionContext: Record<string, unknown> = {}

      Optional initial context to seed the traversal.

    Returns void

Generated using TypeDoc