Heuristic:FlowiseAI Flowise Tool Ordering Convention
| Knowledge Sources | |
|---|---|
| Domains | Agent_Tools, Optimization |
| Last Updated | 2026-02-12 07:30 GMT |
Overview
Implicit tool ordering convention that ensures HTTP request and file I/O tools execute in the correct sequence when multiple tools are connected to an agent.
Description
When multiple tools are connected to an agent node in Flowise, the order in which they appear in the tools array matters for execution. The `rearrangeToolsOrdering` function enforces a specific priority: read operations (RequestsGet, readFile) are placed first (priority 0), write operations (RequestsPost, writeFile) second (priority 1), and all other tools third (priority 2). This ensures that data-fetching tools run before data-writing tools, preventing race conditions where a write depends on data from a read.
Usage
This heuristic applies automatically when connecting tools to agent nodes in the Flowise canvas. Understanding it is important when debugging tool execution order, building custom agent workflows, or troubleshooting unexpected tool behavior where reads and writes happen in the wrong sequence.
The Insight (Rule of Thumb)
- Action: Tools are automatically sorted before being passed to the agent: reads first, writes second, others last
- Value: Priority levels: `requestsGet`/`readFile` = 0, `requestsPost`/`writeFile` = 1, everything else = 2
- Trade-off: This is a heuristic, not a user-configurable setting. If a custom tool needs a specific execution order that conflicts with this convention, it cannot be overridden from the UI.
- Scope: Only affects the order of tools in the tools array; the agent LLM still decides which tools to call
Reasoning
LLM-based agents receive a list of available tools and decide which to invoke. However, the order of tools in the list can influence the agent's behavior (some models are sensitive to tool ordering). By ensuring read/fetch tools appear before write/post tools, the system provides a sensible default that matches the natural data flow: gather information first, then act on it. This is particularly important for simple agent setups where the user connects both a GET and POST tool, expecting the agent to first fetch data and then submit it.
Code Evidence
Tool ordering from `packages/ui/src/utils/genericHelper.js:752-767`:
export const rearrangeToolsOrdering = (newValues, sourceNodeId) => {
// RequestsGet and RequestsPost have to be in order before other tools
newValues.push(`{{${sourceNodeId}.data.instance}}`)
const sortKey = (item) => {
if (item.includes('requestsGet') || item.includes('readFile')) {
return 0
} else if (item.includes('requestsPost') || item.includes('writeFile')) {
return 1
} else {
return 2
}
}
newValues.sort((a, b) => sortKey(a) - sortKey(b))
}