How it works
A compact starting point for building your own AI assistant in n8n. The Chat Trigger gives you a chat window inside the editor. Each message goes to an AI Agent node, which decides on its own whether to answer directly or use a tool first.
Four sub-nodes plug into the agent:
- OpenAI chat model provides the language model (gpt-4.1-mini by default, with a low temperature for steady answers).
- Conversation memory keeps the last 10 messages for each chat session, so follow-up questions work.
- Calculator handles arithmetic exactly instead of letting the model guess.
- Wikipedia looks up facts the model is unsure about.
The system message tells the agent to be concise, to use its tools and to admit when a tool returns nothing useful.
Set up steps
- Import the workflow and open OpenAI chat model.
- Create an OpenAI credential with your API key and choose a model.
- Click Open chat at the bottom of the canvas and try "What is 17.5% of 2,340?" or a general knowledge question.
- To share the assistant, enable public access on the chat trigger and activate the workflow.
Customise it
- Rewrite the system message in AI agent to give it a role, tone and rules for your use case.
- Swap the model node for Anthropic, Google Gemini, Mistral or a local Ollama model.
- Add more tools: an HTTP Request tool for your own API, a sheet lookup, or a sub-workflow.
- Replace the in-memory history with a database-backed memory for persistent conversations.