nexus-agents - v2.80.0
    Preparing search index...

    Class GraphBuilder

    Fluent builder for graph-based workflows.

    Usage:

    const graph = new GraphBuilder()
    .addState('messages', { defaultValue: [], reducer: { type: 'append' } })
    .addNode('classify', classifyHandler)
    .addNode('respond', respondHandler)
    .addEdge(START, 'classify')
    .addConditionalEdge('classify', router, ['respond', 'escalate'])
    .addEdge('respond', END)
    .compile();
    Index

    Constructors

    Methods

    • Adds a conditional edge with a routing function. The router inspects state and returns the target node ID. All possible targets must be declared for compile-time validation.

      Parameters

      • from: string
      • router: (state: Readonly<GraphState>) => string
      • targets: readonly string[]

      Returns this