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

ToolAgent (the non-conversational variant) builds a tool-calling agent and requires the chat model to implement `bindTools()`. If `model.bindTools === undefined` it throws before constructing the RunnableSequence. Identical precondition to error 29, just in ToolAgent.

Source

Thrown at packages/components/nodes/agents/ToolAgent/ToolAgent.ts:333

                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)

    const runnableAgent = RunnableSequence.from([
        {
            [inputKey]: (i: { input: string; steps: ToolsAgentStep[] }) => i.input,
            agent_scratchpad: (i: { input: string; steps: ToolsAgentStep[] }) => formatToOpenAIToolMessages(i.steps),
            [memoryKey]: async (_: { input: string; steps: ToolsAgentStep[] }) => {
                const messages = (await memory.getChatMessages(flowObj?.sessionId, true, prependMessages)) as BaseMessage[]
                return messages ?? []
            },
            ...promptVariables
        },
        prompt,
        modelWithTools,
        new ToolCallingAgentOutputParser()
    ])

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Wire a tool-calling-capable chat model (ChatOpenAI gpt-4/3.5-turbo, ChatAnthropic, etc.).
  2. Upgrade @langchain/core and the provider package.
  3. Implement bindTools on custom model classes.
  4. Confirm the model component is the tool-capable variant.

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.`)
    }
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof (model as any).bindTools !== 'function') {
  throw new Error('ToolAgent needs a tool-calling-capable 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 buildToolAgent(model, tools, ...)
} catch (e) {
  if ((e as Error).message.includes('bindTools()')) swapToToolCapableModel()
  throw e
}

Prevention

When it happens

Trigger: Selected model lacks tool-calling support, or the installed LangChain version predates the bindTools interface. Common when reusing a plain/legacy chat model node.

Common situations: Switched models to one without function calling; downgraded @langchain/core; custom model class without bindTools; using an older Flowise chat-model component.

Related errors


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