Templates / Custom LangChain agent written in JavaScript

Custom LangChain agent written in JavaScript

Needs changes

by n8n Team ✓ · 15,891 views · created 2023-10-03 · Engineering, AI RAG

Needs changes. This template uses 2 thing(s) that n8n 3.0 removes: LangChain Code (legacy), AI Agent v1 (old agent modes). 2 breaking item(s) found. Static check, last run 2026-10-19.

What to replace before upgrading

Removed in 3.0Replace with
LangChain Code (legacy)
Custom - LLM Chain Node1
No direct replacement
AI Agent v1 (old agent modes)
AI Agent (v1.8)
Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Nodes used (6)

LangChain CodeOpenAI Chat ModelAI AgentCode

What it does

This workflow has multiple functionalities. It starts with a manual trigger, "When clicking 'Execute Workflow'", that activates two separate paths. The first path takes a preset string "Tell me a joke" and processes it through a custom Language Learning Model (LLM) chain node. This node interacts with an OpenAI node for query processing. The second path takes another preset string "What year was Einstein born?" and passes it to an "Agent" node. This agent further interacts with a Chat OpenAI node and a custom Wikipedia node to produce the required information. The workflow uses both built-in and custom nodes, and integrates with OpenAI for both paths. It's built for experimenting with language models, specifically in the context of conversational agents and information retrieval. Note that to use this template, you need to be on n8n version 1.19.4 or later.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.