Build custom AI agent with LangChain Gemini self-hosted
Overview This workflow leverages the LangChain code node to implement a fully customizable conversational agent. Ideal for users who need granular control ov...
🔌 Nodes & Integrations Used (3)
📖 Implementation & Setup Guide
Overview This workflow leverages the LangChain code node to implement a fully customizable conversational agent. Ideal for users who need granular control over their agent's prompts while reducing unnecessary token consumption from reserved tool-calling functionality (compared to n8n's built-in Conversation Agent). 
Setup Instructions 1. **Configure Gemini Credentials**: Set up your Google Gemini API key ([Get API key here](https://ai.google.dev/) if needed). Alternatively, you may use other AI provider nodes. 2. **Interaction Methods**: - Test directly in the workflow editor using the "Chat" button - Activate the workflow and access the chat interface via the URL provided by the `When Chat Message Received` node
Customization Options 1. **Interface Settings**: Configure chat UI elements (e.g., title) in the `When Chat Message Received` node 2. **Prompt Engineering**: - Define agent personality and conversation structure in the `Construct & Execute LLM Prompt` node's template variable - ⚠️ Template must preserve `{chat_history}` and `{input}` placeholders for proper LangChain operation 3. **Model Selection**: Swap language models through the `language model` input field in `Construct & Execute LLM Prompt` 4. **Memory Control**: Adjust conversation history length in the `Store Conversation History` node
Requirements: ⚠️ This workflow uses the **LangChain Code node**, which only works on **self-hosted n8n**. *(Refer to [LangChain Code node docs](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.code/))*
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Build custom AI agent with LangChain _ Gemini _self-hosted_.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related AI Agents Workflows
View All in AI Agents →5 ways to process images PDFs with Gemini AI in n8n
How it works Many users have asked in the support forum about different methods to analyze images and PDF documents with Google Gemini AI in n8n. This workfl...
7 AI Sales Assistant
Production-ready n8n automation template for 7 AI Sales Assistant built by AhiXLight. Seamlessly connects Airtop Tool, Slack, Airtop with 24 configured nodes.
AAVE portfolio professional AI agent Telegram Email GPT 4o
A next-generation AI-powered DeFi health monitor that tracks wallet positions across Aave V3 using GPT-4o and LangChain. It delivers human-readable reports v...
Access control for AI agents RBAC using Airtable and Telegram
Purpose This workflow allows granular control over the access to tools connected to AI Agents (including Multi-Agent setups) using Role Based Access Control....