Skip to main content

Examples

Constructors

Methods


Constructors

constructor

Creates a new graph builder. Accepts either an options object or a graph ID string.

Parameters

opts
string | GraphBuilderProps
required
Graph builder options or graph ID string

Returns

GraphBuilder

Methods

addSubgraph

Adds a subgraph to the graph configuration.

Parameters

subgraph
SubgraphBuilder
required
Subgraph builder instance to be added

Returns

this

addIntentSubgraph

Adds an intent subgraph to the graph.

Parameters

id
string
required
Unique identifier for the subgraph
parameters
Config
required
Intent subgraph parameters

Returns

this

addNode

Adds a node to the graph. If an is provided without corresponding component, internal components are automatically added.

Parameters

node
Node | AbstractNode
required
Node to add to the graph

Returns

this

addEdge

Adds an edge connecting two nodes in the graph.

Parameters

fromNode
string | Node | AbstractNode
required
Source node
toNode
string | Node | AbstractNode
required
Destination node
options
object
Optional edge configuration

Returns

this

addComponent

Adds a component to the graph configuration.

Parameters

component
Component | AbstractComponent
required
Component to add to the graph

Returns

this

setStartNode

Sets the start node of the graph.

Parameters

node
string | Node | AbstractNode
required
Start node

Returns

this

setEndNode

Sets the end node of the graph.

Parameters

node
string | Node | AbstractNode
required
End node

Returns

this

setStartNodes

Sets multiple start nodes for the graph.

Parameters

nodes
(string | Node | AbstractNode)[]
required
Array of start nodes

Returns

this

setEndNodes

Sets multiple end nodes for the graph.

Parameters

nodes
(string | Node | AbstractNode)[]
required
Array of end nodes

Returns

this

addMCPSubgraph

Adds an MCP subgraph to the graph.

Parameters

id
string
required
Unique identifier for the subgraph
parameters
Config
required
MCP subgraph parameters

Returns

this

build

Creates a graph executor instance for running the graph.

Returns

Graph