FlowiseAI/Flowise · error · Error

This agent requires that the "bindTools()" method be impleme

Error message

This agent requires that the "bindTools()" method be implemented on the input model.

What it means

ConversationalRetrievalToolAgent constructs a tool-calling agent and requires the LangChain chat model to expose `bindTools()` (the function-calling interface). If `model.bindTools === undefined` the agent cannot attach tools, so it throws before building the runnable. This is a model-capability/version mismatch, not a network error.

Source

Thrown at packages/components/nodes/agents/ConversationalRetrievalToolAgent/ConversationalRetrievalToolAgent.ts:297

                const lastMessage = prompt.promptMessages.pop() as HumanMessagePromptTemplate
                const template = (lastMessage.prompt as PromptTemplate).template as string
                const msg = HumanMessagePromptTemplate.fromTemplate([
                    ...messageContent,
                    {
                        text: template
                    }
                ])
                msg.inputVariables = lastMessage.inputVariables
                prompt.promptMessages.push(msg)
            }

            // Add the `agent_scratchpad` MessagePlaceHolder back
            prompt.promptMessages.push(messagePlaceholder)
        }
    }

    if (model.bindTools === undefined) {
        throw new Error(`This agent requires that the "bindTools()" method be implemented on the input model.`)
    }

    const modelWithTools = model.bindTools(tools)

    // Function to get standalone question (either rephrased or original)
    const getStandaloneQuestion = async (input: string): Promise<string> => {
        // If no rephrase prompt, return the original input
        if (!rephrasePrompt) {
            return input
        }

        // Get chat history (use empty string if none)
        const messages = (await memory.getChatMessages(flowObj?.sessionId, true)) as BaseMessage[]
        const iMessages = convertBaseMessagetoIMessage(messages)
        const chatHistoryString = convertChatHistoryToText(iMessages)

        // Always rephrase to normalize/expand user queries for better retrieval
        try {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Select a chat model known to support tool calling (OpenAI gpt-4/gpt-3.5-turbo, Anthropic Claude 3, etc.).
  2. Upgrade @langchain/core and the provider package to versions that ship bindTools.
  3. If using a custom model class, implement `bindTools(tools)` on it.
  4. Verify the model component wired into the agent is the tool-capable variant (not the plain ChatOpenAI legacy node).

Example fix

// before
    if (model.bindTools === undefined) {
        throw new Error(`This agent requires that the "bindTools()" method be implemented on the input model.`)
    }
// after
    if (typeof model.bindTools !== 'function') {
        throw new Error(`Model "${model.constructor?.name ?? 'unknown'}" does not implement bindTools(). Use a tool-calling-capable chat model (e.g. ChatOpenAI gpt-4, ChatAnthropic).`)
    }
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof (model as any).bindTools !== 'function') {
  throw new Error('Selected model does not support tool calling; pick a tool-capable chat model.')
}

Type guard

const hasBindTools = (m: unknown): m is { bindTools: (tools: unknown[]) => unknown } =>
  typeof (m as any)?.bindTools === 'function'

Try / catch

try {
  const agent = await buildConversationalRetrievalToolAgent(model, tools, ...)
} catch (e) {
  if ((e as Error).message.includes('bindTools()')) swapToToolCapableModel()
  throw e
}

Prevention

When it happens

Trigger: The selected model class does not implement function/tool calling (e.g. older LangChain chat models, some local/Ollama wrappers, base ChatModel without tool support), or the installed @langchain/core version predates bindTools.

Common situations: Switched from an OpenAI tool-calling model to a model that lacks bindTools; downgraded LangChain; using a custom model wrapper that didn't subclass the tool-capable base; pointing at a legacy chat-model component.

Related errors


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