@launchdarkly/server-sdk-ai - v2.0.21
    Preparing search index...

    Class AgentGraphDefinition

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

    Provides graph-level orchestration including relationship queries (parent/child), topological 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.

    Index
    enabled: boolean
    • Traverses the graph in reverse topological order (descendants-first).

      A node is visited only after every reachable descendant has been visited. The root is always visited last. When multiple nodes are simultaneously eligible, they are visited in graph-discovery order for determinism. Cyclic graphs are cycle-safe — each reachable node is visited exactly once (including graphs with no terminal nodes).

      Each call to fn receives a fresh context containing the caller-provided initialExecutionContext plus the return values of exactly that node's reachable descendants — not results from unrelated parallel-branch nodes.

      Parameters

      • fn: TraversalFn

        Callback invoked for each node. Its return value is stored under the node's config key for use by dependent nodes.

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

        Optional initial context visible to every node.

      Returns void

    • Traverses the graph in topological order from the root (predecessors-first).

      A node is visited only after every reachable predecessor has been visited. The root is visited first. When multiple nodes are simultaneously eligible, they are visited in graph-discovery order (BFS from root following declared edge order) for determinism. Cyclic graphs are cycle-safe — each reachable node is visited exactly once.

      Each call to fn receives a fresh context containing the caller-provided initialExecutionContext plus the return values of exactly that node's reachable predecessors — not results from unrelated parallel-branch nodes.

      Parameters

      • fn: TraversalFn

        Callback invoked for each node. Its return value is stored under the node's config key for use by dependent nodes.

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

        Optional initial context visible to every node.

      Returns void