Nanosaur2-670M
well9472 · Kit
Makes illustrations from text prompts with a small 670M-parameter diffusion model, run through ComfyUI. Built as a low-budget research model for people who wan…
An n8n workflow with two small LangChain demos in Code nodes: a hand-written chain that answers “Tell me a joke”, and an agent with a hand-written Wikipedia tool that answers what year Einstein was born.
LangChain Code node examples: a chain and a Wikipedia tool is an n8n workflow in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.
Manual run
It starts when you press Execute workflow, and one press runs both demos with:
Two answers in the run: a joke from the hand-written chain, and Einstein’s birth year from the agent
What you need before you start.
Language model
Runs gpt-5.6-terra for the hand-written chain and a chat model, gpt-5-mini by default, for the agent.
NeedsOpenAI API key, in an OpenAI credential
Knowledge lookup
Answers the agent’s searches through the Wikipedia tool that the second Code node supplies.
NeedsNo sign-in
Checked by Mindket on 13 Nov 2026
This n8n workflow shows how to write LangChain steps yourself in n8n’s LangChain Code node. One press of Execute workflow starts two demos side by side. In the first, a Code node builds a prompt from the question “Tell me a joke”, pipes it into an OpenAI chat model and returns the answer. In the second, an AI Agent gets a Wikipedia tool that a second Code node supplies, and answers “What year was Einstein born?”. Eight nodes do the work, beside two sticky notes that name the demos.
Developers who know some JavaScript and want a working pattern for custom LangChain code inside n8n before they write their own. Skip it if you want a finished business workflow. It holds two fixed questions and no output beyond the run.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Software | Backend developers | Copy the chain’s code as the start of a custom prompt flow | A developer changes the prompt line and keeps the rest. |
| AI engineering | Prototype builders | Add a tool the agent can call, written as a Code node | An engineer swaps the Wikipedia class for a call to the company’s own search. |
| Training | Course authors | Show how n8n lets code join its AI nodes | An instructor runs both demos live in a workshop. |
| Consulting | Automation consultants | Find where the built-in nodes stop and code has to take over | A consultant reads the chain’s code before proposing a custom step. |
You need some n8n and some JavaScript: import a file, add one OpenAI credential in two places and read two short scripts.
Any n8n that can reach OpenAI’s API and has the LangChain Code node will run it. Wikipedia needs no key.
Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. The same OpenAI key serves both demos.
| Need | Detail |
|---|---|
| n8n | On n8n Cloud or on a server of your own, with the LangChain Code node |
| OpenAI | An API key for an OpenAI credential. The chain’s model is gpt-5.6-terra, and the agent’s is the node’s default |
workflow.json.OpenAI Chat Model and in Chat OpenAI.Set and Set1 to read the two questions. Change them if you like.Agent for the Einstein answer.Press Execute workflow and both demos run from the same trigger. Each Code node can write to the browser’s console with console.log, and the tool’s Code node logs a line when the agent calls it.
| To change | Where |
|---|---|
| The questions | input in Set and in Set1 |
| The chain’s steps | The code in the chain’s Code node |
| The agent’s tool | The code in the tool’s Code node |
| The models | OpenAI Chat Model for the chain, Chat OpenAI for the agent |
A developer runs it unchanged, with “Tell me a joke” in Set and “What year was Einstein born?” in Set1.
The chain’s Code node returns an item whose output holds the model’s joke as text. Agent returns an output that gives Einstein’s birth year, 1879. A model can also answer that from memory without calling the tool.
If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. LangChain is a toolkit for building apps around language models, and n8n’s AI nodes run on it. The LangChain Code node lets you write that code by hand. Run the file as it is first, then change one question.
For experts. The chain’s node reads whichever model is connected, so swapping the model node needs no code change.
| Node | What it does | What to know |
|---|---|---|
| The chain’s Code node | A LangChain Code node in execute mode, with a main input and one required language model input | It reads the model with getInputConnectionData, pipes the prompt into it and returns output |
| The tool’s Code node | A LangChain Code node in supply data mode, with an AI tool output | It returns a WikipediaQueryRun object for the agent to call |
Agent | AI Agent 1, a conversational agent by default | It reads its question from input, the field Set1 writes |
The original copy called a model that is gone, and its imports no longer exist.
gpt-3.5-turbo-instruct. OpenAI shut that model down on 28 September 2026. Its named replacement, gpt-5.6-terra, does not take the old completions endpoint, so Mindket’s copy uses a chat model node set to gpt-5.6-terra and the chain returns the reply’s content. OpenAI’s deprecations and model pages were read on 12 November 2026langchain/prompts and langchain/tools. The starter code in n8n’s current Code node, read on 12 November 2026, imports @langchain/core/prompts and @langchain/community/tools/wikipedia_query_run, and Mindket’s copy uses thoseChat OpenAI leaves its model at the node’s default, gpt-5-mini. OpenAI’s page gives 11 December 2026 for its shutdown, with gpt-5.6-terra as the replacement{ and } in it is read as a variableAn n8n workflow with two small demos of n8n's LangChain Code node. In the first, hand-written code builds a prompt for
"Tell me a joke", pipes it into an OpenAI chat model and returns the answer. In the second, an AI Agent answers "What
year was Einstein born?" with a Wikipedia tool that a second Code node supplies.
workflow.json: the workflow as n8n exports it, ten nodes. Eight do the work and two are sticky notes that name theREADME.md: these notes.gpt-3.5-turbo-instruct, which OpenAI shut down on 28 September 2026. The replacement OpenAI names,gpt-5.6-terra, does not take the legacy completions endpoint. The node is now an OpenAI Chat Model, version 1.2,OpenAI Chat Model, with gpt-5.6-terra in its ID field.(await chain.invoke()).content.langchain/prompts and the tool imported langchain/tools. n8n's own starter code for the node,@langchain/core/prompts and @langchain/community/tools/wikipedia_query_run, solangchain/tools path but not langchain/prompts.workflow.json.OpenAI Chat Model and in Chat OpenAI.Set and Set1 to read the two questions. Change them if you like.Custom - LLM Chain Node for the joke and Agent for the Einstein answer.Set and Set1, which write one input field each.Custom - LLM Chain Node (LangChain Code, execute mode) has one main input and one required language model input.PromptTemplate.fromTemplate from input, reads the connected model withgetInputConnectionData('ai_languageModel', 0), pipes the prompt into it and returns an item with output.Agent (AI Agent 1, a conversational agent by default) reads its question from input. It uses Chat OpenAI, whoseCustom - Wikipedia.Custom - Wikipedia (LangChain Code, supply data mode, an AI tool output) logs a line and returns aWikipediaQueryRun object. The agent calls it when it wants to look something up.input value in Set and Set1.Custom - LLM Chain Node. Chain more steps after the prompt, or parse the answer.Custom - Wikipedia. Return any LangChain tool object, such as one that calls your own search.OpenAI Chat Model for the chain and Chat OpenAI for the agent. The chain reads whichever model isconsole.log inside a Code node writes to the browser's console.{ and } in it is read as a variable.Chat OpenAI leaves its model at the node's default, gpt-5-mini. OpenAI's deprecations page, read on 12 Novembergpt-5.6-terra as the replacement.NOTICE.md 611 B README.md 4 KB workflow.json 6 KB
well9472 · Kit
Makes illustrations from text prompts with a small 670M-parameter diffusion model, run through ComfyUI. Built as a low-budget research model for people who wan…
Waqf-AI · Kit
Reads handwritten Arabic text from images and returns it as text. A fine-tuned PaddleOCR-VL model for people digitizing Arabic handwriting.
Wan-AI · Kit
Makes video clips from a text prompt or an image plus text, at up to 720P and 24 frames per second, in the Diffusers format for a single consumer GPU.
Wan-AI · Kit
Generates cinematic video of a character driven by an audio track, and can also lip-sync existing video. For video creators, animators and researchers with a l…
Wan-AI · Kit
Animates a character or swaps one into a video by copying a performer's movement and expressions, as one model from the Wan2.2 video family. Use only faces and…
vllm-sr · Kit
Answers choice, yes-or-no, score, box and tracking questions about text, images or video in one call, with a probability for each answer. For people building r…