n8n · AI agents & LLM
n8n AI workflows
n8n is a source-available automation tool with first-class AI nodes built on LangChain. You wire a chat model to your own apps and data — no glue code — and run it on infrastructure you control.
What counts as an AI workflow
An “AI workflow” spans a wide range: at the small end, a single LLM step that rewrites or classifies text; at the other, an autonomous AI Agent that reasons over a goal and calls tools until it is done. n8n covers both with the same visual canvas. Everything below shows the real node layout — bring your own API key, and it stays in your n8n credentials.
The AI nodes you’ll use
- AI AgentAn LLM that picks and calls tools — HTTP requests, your app nodes, a sub-workflow, or a vector store — looping until the task is done, then returning the answer.
- Basic LLM ChainOne fixed prompt in, text out. The workhorse for rewriting, summarizing, classifying and extracting.
- Vector Store (RAG)Embed your own docs into Qdrant, Pinecone, Supabase or PGVector, then let the model answer from them with sources.
- Model nodesSwap between OpenAI, Anthropic Claude, Google Gemini, Mistral, Groq or a local Ollama model without rebuilding the flow.
- Structured outputOutput Parser and Information Extractor turn a freeform reply into clean JSON for the next node to use.
AI workflow blueprints
These are build blueprints — they show the exact nodes and order to wire up, not a one-click import file. Verified, downloadable workflow files publish on our n8n templates pages as each is built and tested on a real instance.
- Trigger Gmail Trigger On new email Watches the inbox label of a shared mailbox
- AI AI Agent Classify: billing · bug · sales · other Model gpt-4o-mini; your category taxonomy in the system prompt
- Logic Switch Route by category One branch per label
- Action Gmail + Slack Apply label, post to channel Replace {{YOUR_SLACK_CHANNEL_ID}} per branch
- Trigger Chat Trigger Hosted chat or webhook Public chat widget or an internal endpoint
- AI Vector Store (retrieve) Top-k chunks from your docs Qdrant / Pinecone / Supabase, embedded ahead of time
- AI Question & Answer Chain Answer from retrieved context Grounds the model in your knowledge base
- Action Respond to Chat Return answer + sources Cite the source chunks to reduce hallucination
- Trigger Schedule Trigger Cron: weekdays 09:00
- Action Google Sheets Read next idea row Where status = todo
- AI Basic LLM Chain Draft a post from the idea Prompt template + your brand voice
- Action Google Sheets Write the draft back status = drafted, queued for a human review
- Trigger Webhook New lead from a form
- AI AI Agent Research the company & enrich HTTP Request tool + LLM; returns firmographics as JSON
- Logic Set Map the enriched fields
- Action HubSpot + Slack Upsert contact, alert sales Replace {{YOUR_HUBSPOT_CREDENTIAL}}
How to build an AI workflow in n8n
- Add your model credentialIn n8n, create a credential for your AI provider — OpenAI, Anthropic, Google or Mistral — or point a model node at a local Ollama server. The key stays in your n8n credentials.
- Choose Agent or ChainUse the AI Agent node when the model must decide and call tools. Use a Basic LLM Chain when a single fixed prompt is enough.
- Give the agent its toolsAttach tools to the AI Agent: an HTTP Request tool, your app nodes, a sub-workflow, or a vector store for retrieval.
- Add a triggerWire a Chat Trigger, Webhook, Schedule or app trigger (like Gmail) to the front of the flow.
- Wire the output to your appsSend the result to Slack, Sheets, your CRM or an HTTP response. Add an Output Parser when you need clean JSON.
- Test, then activateRun once with sample input, confirm each node turns green end-to-end, then toggle the workflow Active.
Writing the prompt for the LLM step? Start from a tested AI prompt library instead of a blank box.
Frequently asked questions
What is an n8n AI workflow?
An automation where an LLM is one of the steps. It can be a single prompt that summarizes or classifies data, or a full AI Agent that decides which tools to call to finish a task — all wired visually on the n8n canvas.
Which AI models can n8n use?
n8n connects to OpenAI, Anthropic Claude, Google Gemini, Mistral, Groq and Azure OpenAI, and to local models through Ollama. You can swap the model node without rebuilding the rest of the workflow.
What is the difference between the AI Agent node and an LLM Chain?
A Basic LLM Chain runs one fixed prompt and returns text. The AI Agent can reason over a goal and call tools — HTTP requests, your app nodes, a vector store — looping until the task is done.
Do I need to write code?
No. AI workflows are built by connecting nodes on the canvas. A Code node is available if you want custom logic, but it is optional.
Are these free?
The blueprints and guidance here are free. You run them on your own n8n (self-hosting is free and open-source) and pay your AI provider for token usage on your own key.