MCPcopy
hub / github.com/FlowiseAI/Flowise / buildAgentGraph

Function buildAgentGraph

packages/server/src/utils/buildAgentGraph.ts:36–409  ·  view source on GitHub ↗
({
    agentflow,
    flowConfig,
    incomingInput,
    nodes,
    edges,
    initializedNodes,
    endingNodeIds,
    startingNodeIds,
    depthQueue,
    chatHistory,
    uploadedFilesContent,
    appDataSource,
    componentNodes,
    sseStreamer,
    shouldStreamResponse,
    cachePool,
    baseURL,
    signal,
    orgId,
    workspaceId
}: {
    agentflow: IChatFlow
    flowConfig: IFlowConfig
    incomingInput: IncomingInput
    nodes: IReactFlowNode[]
    edges: IReactFlowEdge[]
    initializedNodes: IReactFlowNode[]
    endingNodeIds: string[]
    startingNodeIds: string[]
    depthQueue: IDepthQueue
    chatHistory: IMessage[]
    uploadedFilesContent: string
    appDataSource: DataSource
    componentNodes: IComponentNodes
    sseStreamer: IServerSideEventStreamer
    shouldStreamResponse: boolean
    cachePool: CachePool
    baseURL: string
    signal?: AbortController
    orgId: string
    workspaceId?: string
})

Source from the content-addressed store, hash-verified

34 * Build Agent Graph
35 */
36export const buildAgentGraph = async ({
37 agentflow,
38 flowConfig,
39 incomingInput,
40 nodes,
41 edges,
42 initializedNodes,
43 endingNodeIds,
44 startingNodeIds,
45 depthQueue,
46 chatHistory,
47 uploadedFilesContent,
48 appDataSource,
49 componentNodes,
50 sseStreamer,
51 shouldStreamResponse,
52 cachePool,
53 baseURL,
54 signal,
55 orgId,
56 workspaceId
57}: {
58 agentflow: IChatFlow
59 flowConfig: IFlowConfig
60 incomingInput: IncomingInput
61 nodes: IReactFlowNode[]
62 edges: IReactFlowEdge[]
63 initializedNodes: IReactFlowNode[]
64 endingNodeIds: string[]
65 startingNodeIds: string[]
66 depthQueue: IDepthQueue
67 chatHistory: IMessage[]
68 uploadedFilesContent: string
69 appDataSource: DataSource
70 componentNodes: IComponentNodes
71 sseStreamer: IServerSideEventStreamer
72 shouldStreamResponse: boolean
73 cachePool: CachePool
74 baseURL: string
75 signal?: AbortController
76 orgId: string
77 workspaceId?: string
78}): Promise<any> => {
79 try {
80 const chatflowid = flowConfig.chatflowid
81 const chatId = flowConfig.chatId
82 const sessionId = flowConfig.sessionId
83 const analytic = agentflow.analytic
84 const uploads = incomingInput.uploads
85
86 const options = {
87 orgId,
88 workspaceId,
89 chatId,
90 sessionId,
91 chatflowid,
92 chatflowId: chatflowid,
93 logger,

Callers 1

executeFlowFunction · 0.90

Calls 15

clearSessionMemoryFunction · 0.90
getErrorMessageFunction · 0.90
compileMultiAgentsGraphFunction · 0.85
compileSeqAgentsGraphFunction · 0.85
streamStartEventMethod · 0.65
streamNextAgentEventMethod · 0.65
streamTokenEventMethod · 0.65
streamActionEventMethod · 0.65
streamUsedToolsEventMethod · 0.65
streamArtifactsEventMethod · 0.65

Tested by

no test coverage detected