{"record":{"id":"ddf44f1b93455495","repo":"n8n-io/n8n","slug":"tools-agent-requires-chat-model-which-supports-too","errorCode":null,"errorMessage":"Tools Agent requires Chat Model which supports Tools calling","messagePattern":"Tools Agent requires Chat Model which supports Tools calling","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/common.ts","lineNumber":498,"sourceCode":"\tindex: number = 0,\n): Promise<BaseChatModel | undefined> {\n\tconst connectedModels = await ctx.getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0);\n\n\tlet model;\n\n\tif (Array.isArray(connectedModels) && index !== undefined) {\n\t\tif (connectedModels.length <= index) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// We get the models in reversed order from the workflow so we need to reverse them to match the right index\n\t\tconst reversedModels = [...connectedModels].reverse();\n\t\tmodel = reversedModels[index] as BaseChatModel;\n\t} else {\n\t\tmodel = connectedModels as BaseChatModel;\n\t}\n\n\tif (!isChatInstance(model) || !model.bindTools) {\n\t\tthrow new NodeOperationError(\n\t\t\tctx.getNode(),\n\t\t\t'Tools Agent requires Chat Model which supports Tools calling',\n\t\t);\n\t}\n\treturn model;\n}\n\n/**\n * Retrieves the memory instance from the input connection if it is connected\n *\n * @param ctx - The execution context\n * @returns The connected memory (if any)\n */\nexport async function getOptionalMemory(\n\tctx: IExecuteFunctions | ISupplyDataFunctions | IWebhookFunctions,\n): Promise<BaseChatMemory | undefined> {\n\treturn (await ctx.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as\n\t\t| BaseChatMemory","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/common.ts#L480-L516","documentation":"Thrown by getChatModel (Tools Agent common.ts) when the connected model either is not a chat-model instance (isChatInstance returns false) or does not implement bindTools. Tools Agent requires a chat model that supports tool calling; classic LLMs or completion-only models are rejected.","triggerScenarios":"A non-chat-model node (e.g. a legacy LLM Chain model, a completion-only model, or a custom model that doesn't extend BaseChatModel) is connected to the Agent's Chat Model input; or the chat model exists but lacks bindTools (older LangChain version).","commonSituations":"User connected an older model node; a community node exposes a non-chat model; LangChain version mismatch where bindTools is absent; misrouted connection (memory or embedding node plugged into the model input).","solutions":["Connect a chat model that supports tool calling (e.g. OpenAI Chat Model, Anthropic Chat Model, Google Gemini Chat Model) to the Chat Model input.","Verify the connected node is a chat-model node and not an embedding, LLM, or memory node.","Upgrade @n8n/nodes-langchain / langchain dependencies so bindTools is present."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const model = await getChatModel(this, 0);\nif (!model) {\n  throw new NodeOperationError(this.getNode(), 'No chat model connected to the Agent.');\n}","typeGuard":"function isToolCallingChatModel(model: unknown): model is BaseChatModel {\n  return (\n    !!model &&\n    typeof (model as any).bindTools === 'function' &&\n    isChatInstance(model)\n  );\n}","tryCatchPattern":null,"preventionTips":["Always connect a chat model node that supports tool calling (OpenAI/Anthropic/Gemini Chat Model).","Double-check the connection lands on the Chat Model input, not Memory or Embedding.","Keep @n8n/nodes-langchain and langchain up to date so bindTools is present."],"tags":["langchain","agent","tools-agent","model","tools-calling","configuration"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}