Overview
toolAgentFlow is a static JavaScript object that defines the default ReactFlow graph template (nodes and edges) used when creating a custom assistant's underlying chatflow, consisting of a Buffer Memory node, a ChatOpenAI node, and a Tool Agent node.
Description
This module exports a single constant object representing a pre-configured flow graph with three nodes and two edges. The bufferMemory_0 node provides chat history storage, the chatOpenAI_0 node wraps the OpenAI chat model with configurable parameters (model, temperature, streaming, etc.), and the toolAgent_0 node is the orchestrating agent that connects to memory and model. The edges wire the buffer memory output to the tool agent's memory input and the ChatOpenAI output to the tool agent's model input. This template serves as the initial flow skeleton that the CustomAssistantConfigurePreview component programmatically modifies when saving assistant configurations.
Usage
Use this object as the base flow template when creating or updating the chatflow associated with a custom assistant. The CustomAssistantConfigurePreview component clones this template and replaces the ChatOpenAI node with the user's selected chat model and injects selected tools as additional nodes/edges.
Code Reference
Source Location
Signature
export const toolAgentFlow = {
nodes: [ ... ],
edges: [ ... ]
}
Import
import { toolAgentFlow } from '@/views/assistants/custom/toolAgentFlow'
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| (none) |
-- |
-- |
This is a static data export with no runtime inputs
|
Outputs
| Name |
Type |
Description
|
| toolAgentFlow |
object |
Flow graph object with nodes (array of 3 node definitions) and edges (array of 2 edge connections)
|
Node Definitions
bufferMemory_0
| Property |
Value
|
| Type |
BufferMemory
|
| Category |
Memory
|
| Description |
Retrieve chat messages stored in database
|
| Key Params |
sessionId (optional), memoryKey (default: "chat_history")
|
chatOpenAI_0
| Property |
Value
|
| Type |
ChatOpenAI
|
| Category |
Chat Models
|
| Description |
Wrapper around OpenAI large language models using the Chat endpoint
|
| Key Params |
credential (openAIApi), modelName (default: "gpt-4o-mini"), temperature (0.9), streaming (true), maxTokens, topP, frequencyPenalty, presencePenalty, timeout, basepath, allowImageUploads
|
toolAgent_0
| Property |
Value
|
| Type |
ToolAgent
|
| Category |
Agents
|
| Description |
Agent optimized for tool usage with configurable system message and max iterations
|
| Key Inputs |
model (from ChatOpenAI), memory (from BufferMemory), tools (dynamically injected)
|
Edge Definitions
| Source |
Target |
Connection
|
| bufferMemory_0 |
toolAgent_0 |
BufferMemory output to Tool Agent memory input
|
| chatOpenAI_0 |
toolAgent_0 |
ChatOpenAI output to Tool Agent model input
|
Usage Examples
Basic Usage
import { toolAgentFlow } from '@/views/assistants/custom/toolAgentFlow'
import { cloneDeep } from 'lodash'
// Clone the template to avoid mutation
const flowData = cloneDeep(toolAgentFlow)
// Replace the chat model node with user's selected model
flowData.nodes[1] = selectedChatModelNode
// Add tool nodes and edges
selectedTools.forEach(tool => {
flowData.nodes.push(tool.nodeData)
flowData.edges.push(createEdge(tool, 'toolAgent_0'))
})
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.