FlowiseAI/Flowise · error · Error

Agent needs to have a function calling capable models.

Error message

Agent needs to have a function calling capable models.

What it means

Before invoking the agent, the code binds tools to the LLM via llmNodeInstance.bindTools(toolsInstance). If the resolved LLM instance has no bindTools method (undefined), the model cannot do function/tool calling, so the agent aborts. This is a capability check on the LangChain chat model wrapper.

Source

Thrown at packages/components/nodes/agentflow/Agent/Agent.ts:997

                    const builtInTool: ICommonObject = {
                        type: tool,
                        name: toolName
                    }
                    ;(toolsInstance as any).push(builtInTool)
                    ;(availableTools as any).push({
                        name: tool,
                        toolNode: {
                            label: tool,
                            name: tool
                        }
                    })
                }
            }

            if (llmNodeInstance && toolsInstance.length > 0) {
                if (llmNodeInstance.bindTools === undefined) {
                    throw new Error(`Agent needs to have a function calling capable models.`)
                }

                // @ts-ignore
                llmNodeInstance = llmNodeInstance.bindTools(toolsInstance)
            }

            // Prepare messages array
            const messages: BaseMessageLike[] = []

            // Prepend history ONLY if it is the first node
            if (prependedChatHistory.length > 0 && !runtimeChatHistory.length) {
                for (const msg of prependedChatHistory) {
                    const role: string = msg.role === 'apiMessage' ? 'assistant' : 'user'
                    const content: string = msg.content ?? ''
                    messages.push({
                        role,
                        content
                    })

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Switch the Agent's model to a function-calling-capable chat model (e.g. gpt-4o, gpt-4-turbo, Claude 3, Gemini 1.5).
  2. Remove the tools from the agent if the model must stay non-function-calling (run it as a plain chat node).
  3. Upgrade langchain/@langchain/core so the model wrapper exposes bindTools.
  4. If using a custom LLM node, implement bindTools(tools) on its class.

Example fix

// before: agentModel points to a legacy LLM
inputs.agentModel = 'llamaLegacy'

// after: use a function-calling chat model
inputs.agentModel = 'chatOpenAI'
inputs.agentModelConfig = { model: 'gpt-4o', modelName: 'gpt-4o' }
Defensive patterns

Strategy: type-guard

Validate before calling

function isFunctionCallingCapable(llmNodeInstance) {
  return typeof llmNodeInstance?.bindTools === 'function'
}
// after init, before run:
if (toolsInstance.length > 0 && !isFunctionCallingCapable(llmNodeInstance)) {
  throw new Error('Selected model does not support function calling; pick a function-calling model or remove tools')
}

Type guard

function supportsBindTools(llm) {
  return !!llm && typeof llm.bindTools === 'function'
}

Try / catch

try {
  // agent.run(...)
} catch (e) {
  if (/function calling capable/.test(e.message)) {
    // prompt user to switch model or remove tools
  } else throw e
}

Prevention

When it happens

Trigger: Selecting a chat model whose LangChain wrapper lacks bindTools (older LLM classes, some non-chat LLMs, certain embeddings-only or legacy completions models); toolsInstance.length > 0 combined with a non-function-calling model; a custom LLM node that did not implement bindTools.

Common situations: Switching the agent model from GPT-4/Claude to a smaller or older model that does not support tool calling; using a local LLM wrapper without function-calling support; langchain version downgrade removing bindTools from a model class; mixing an LLM (non-chat) node instead of a ChatModel node.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/0a4db8bb25c8d575. Report an issue: GitHub.