AcademyWorkflowsDevelopment

Custom AI agent with LangChain and Gemini

Development teams that build a chat assistant and want full control over its prompt and memory.

  • Recommendedour rating
  • 4,410views on n8n
Open on n8n.io ↗

Paste it straight onto an n8n canvas with Ctrl+V or Cmd+V.

build-custom-ai-agent-with-langchain-gemini-self-hosted.json

Loading the file...

What it does

A self-hosted n8n workflow that runs a conversational agent through the LangChain Code node, with Google Gemini as the language model. You control the prompt and the length of the conversation memory. It avoids the reserved tool-calling functionality of n8n's built-in agent, which can add token use. The LangChain Code node only works on self-hosted n8n.

Use cases

  1. 01Building an internal chat assistant with a fixed prompt
  2. 02Testing a conversation in the n8n editor
  3. 03Swapping the Gemini model for another provider

Connects

LangChain Code · Simple Memory · Google Gemini Chat Model

Questions about
Custom AI agent with LangChain and Gemini.

What is Custom AI agent with LangChain and Gemini used for?

Development teams that build a chat assistant and want full control over its prompt and memory. A self-hosted n8n workflow that runs a conversational agent through the LangChain Code node, with Google Gemini as the language model. You control the prompt and the length of the conversation memory. It avoids the reserved tool-calling functionality of n8n's built-in agent, which can add token use. The LangChain Code node only works on self-hosted n8n.

How do I import Custom AI agent with LangChain and Gemini into n8n?

Copy the workflow JSON from this page and paste it onto the n8n canvas with Ctrl+V or Cmd+V. Then connect your credentials in each node.

Is Custom AI agent with LangChain and Gemini safe to use?

It passed our automatic scan for credential theft, hidden instructions and risky install commands. Third party open source software. Sabemos AI does not maintain it. Check the code and permissions before you connect it to company data.