Memuat
Memuat
Watch every step above performed live, with English narration.
0 plays
Class book
Page 1 / 5
Cover: Agentic AI Without Coding Class #31: The AI Agent Node in n8n: Model, Tools, and Memory
Click a page or use ◀ ▶ to turn · swipe on mobile · to enlarge
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Agentic AI Without Coding Class #31: The AI Agent Node in n8n: Model, Tools, and Memory”.
Other ways we can help with Agentic AI.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

MATLAB Agentic AI Course: Building Autonomous AI Agents with MATLAB & Simulink

Midjourney Course: Create Stunning AI Images from Text
★ 4.9

DALL-E Course: Creating Professional AI Images from Text
★ 4.9
Have it built for you
No time to learn Agentic AI? Our team can do the project for you.

MATLAB & Simulink Development — Agentic AI for Simulation Automation and Data Analysis

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9
Get notified about new Agentic AI classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
Welcome to Session 7 of Agentic AI Without Coding. In Session 6 we built our first workflow that runs on its own. Now we go one level higher: we build an agent that has tools. In this episode we get to know the AI Agent node in n8n and its three pieces of equipment: the model as the brain, memory as the recall, and tools as the hands. Then we set them up one by one and test them.
Let's first recall the workflow we built in Session 6. Everything starts with the trigger, the thing that kicks it off. Every time an order form comes in, the workflow runs right away. The second node is the AI step. It sends the form contents to an AI model with one fixed instruction: summarize the customer's message, then label it as an order, a question, or a complaint. The result is saved as a new row in Google Sheets. Finally, Gmail sends a notification to the admin. This workflow is already very useful, and it may have been running in your business since the last session. But look at the pattern. The path is always the same, from left to right. The AI step in the middle runs just one instruction. It can't decide to check the stock first, or choose not to send the email. Now let's line up the differences. The first row is the work path. The AI step in Session 6 follows the order of the nodes we placed. The agent chooses its own path, depending on the message that comes in. The second row is the AI's job. The AI step runs one instruction, such as summarizing. The agent is given a goal, such as serving customers, and may take several steps to reach it. The third row is tools. The AI step only produces text. The agent can call tools: read Google Sheets, add a row, or send an email. The fourth row is memory. The AI step always starts from zero on every run. The agent can be given memory, so it remembers what was said a few messages earlier. And the last row: the AI step is best for a flow that is always the same. The agent is best for varied conversations, like a customer chat that asks about stock, then the price, and then places an order. This is the main idea of Session 7. The agent chooses its own tools, based on the message it receives. Our job changes. We no longer arrange the order of steps. We provide safe tools, write clear rules, and then let the agent decide when to use those tools. Here's an example at Sunset Coffee. If a customer just says hello, the agent simply replies. If a customer asks about stock, the agent opens the stock data. If a customer places an order, the agent logs the order and lets Dimas know. One workflow, three different paths, chosen by the agent itself.
An agent in n8n is made of five parts. First, the Chat Trigger. This is the entrance for messages, whether from customers or from you while testing. Second, the AI Agent node. This is the control center. It reads the message, weighs what is needed, and decides the next step. Third, the Chat Model, which is the brain. Here we choose a language model from a provider such as OpenAI, Anthropic, or Google. Fourth, Memory, which is the recall. Memory stores the last few messages in one conversation session, so the agent doesn't ask again about things already mentioned. And fifth, Tools, which are the hands. Through these tools the agent can read stock data, log orders, or send a message to the admin. This is how the five parts look on the canvas. On the left is the Chat Trigger. Its left side is slightly rounded, a sign that this node starts the workflow. To its right is the AI Agent node. Its box is wider than a regular node, and along the bottom there are several connection points. From the first point, a dashed line runs down to the Chat Model. This connection is required. Without a model, the agent can't think, and n8n marks the agent node with a warning. The second point connects to Memory. This connection can be left empty, but for an agent that handles chats, memory is almost always needed. The third point connects to Tools. Here we can attach many tools at once, for example a tool to read stock, a tool to log orders, and a tool to send email. Notice the difference from Session 6. The gray arrow lines are the order of steps. The purple dashed lines are equipment the agent uses whenever it needs it, not steps in a sequence.
Now let's practice. Open n8n, create a new workflow, and name it Sunset Coffee Admin Agent. The canvas is still empty. Click the add button, then type chat in the search box. Choose On chat message. The trigger node appears on the canvas with the name When chat message received. This node opens a small chat window so you can test the agent right from the editor. Leave the public chat option turned off. We don't want other people to reach this agent until it is fully tested. Connecting it to WhatsApp or Telegram comes in Session 8. Look at the two pieces of data this node sends. The first yellow box takes the text of the typed message. The second box takes the conversation's session number. The memory will use this session number later. Next, click the plus sign to the right of the trigger, then search for AI Agent. The agent node appears wider than the other nodes, connected by an arrow from the trigger. In the settings panel, the message source is already filled in automatically: Connected Chat Trigger Node. This means the agent reads the message from that chat trigger. We don't need to type anything. The System Message field, the agent's standing instructions, stays empty for now. We write the full Sunset Coffee admin instructions in Episode 34. One good habit: rename your nodes so they are easy to read. For example, name the agent node Admin Agent. As the workflow grows, clear names really help you and your teammates follow the flow. Close the panel. The AI Agent node now shows a red mark. That's normal, because the agent doesn't have a brain yet. Let's add one now.
Click the Chat Model point below the AI Agent node. A list of providers appears: OpenAI, Anthropic, Google Gemini, and more. For this example we choose OpenAI Chat Model. Look at the line: it's dashed, from the bottom of the agent up to the model. The model is the brain that reads the message and decides the steps. As soon as it's connected, the red mark on the agent node disappears. To connect to the model, n8n asks for a credential in the form of an API key, an access key from the model provider. You create this key on the provider's developer page, separate from a regular ChatGPT or Claude subscription. Using a model through the API is billed by how much text is processed, so check your provider's latest pricing page. For a shop admin agent, a small, economical model is usually enough. The temperature option controls how freely the model phrases its sentences. For an admin that answers prices and stock, a low value like zero point three keeps answers more consistent from day to day. Now click the Memory point and choose Simple Memory. In older versions this node was called Window Buffer Memory, so the name may differ slightly depending on your n8n version. This memory remembers the last few messages per session. The session key is taken automatically from the session number in the chat trigger, so Rina's conversation doesn't get mixed up with Budi's. Context Window Length is set to five. This means the agent remembers the last five rounds of questions and answers in that session. How to choose the right number is covered in Episode 34. Because an API key can be used to charge costs to your account, let's protect it properly. First, store it only in the Credentials menu. Never write it inside a prompt or an instruction. Second, give the credential a clear name, such as Sunset Coffee OpenAI account. If you later run several businesses or clients, you won't be confused about which one to pick. Third, set a monthly usage limit in the model provider's dashboard, so the bill doesn't balloon if there is a mistake in the workflow. And the one marked with a cross: never send an API key by chat, email, or a WhatsApp group. If a key does get shared, delete it right away in the provider's dashboard and create a new one.
The last part is the tools. Click the Tool point below the agent. The list is long: Google Sheets, Gmail, Google Calendar, HTTP Request, and many more. For the first test, choose the simplest one: Calculator. The Calculator is a math tool with no settings at all. We use it to prove one important thing: the agent decides on its own when to use a tool, and when not to. Now the full setup is visible: one trigger, one agent, and three sub-nodes. Save the workflow, then click the Open chat button below the canvas to start testing. The chat window opens. We start with a simple greeting: hi, good morning. The agent replies right away. Notice there is no tool line here. A greeting doesn't need a tool, so the agent answers directly from its model. Now ask a math question: three one-liter palm sugar iced coffees and two cold brews, with the prices we state ourselves in the message. This time a gray line with a gear icon appears. That's the sign the agent is calling a tool. It decided on its own to use the Calculator, because the question is about math. The tool's result is used to write the answer: three hundred sixty-five thousand rupiah. We never wrote a rule saying if there are numbers, then calculate. The agent chose. The last question: is there still cold brew in stock today? The answer is honest: the agent doesn't have access to the stock data yet. That's actually a good answer. It's better to admit not knowing than to make up a number. We prepare the stock and price data in the next episode. How do we know what happened inside? Go back to the canvas. Every node that was used has a green check mark, and the side panel shows the execution log for that math message. Read it from the top. The memory is read first, then the model decides that this question needs a calculation. The Calculator is called with a problem the model wrote itself, and it returns the result. The model reads that result and writes a friendly answer. Finally, the memory saves the message and the answer. Make a habit of opening a log like this whenever the agent gives a strange answer. This is where you see which tool was chosen, and with what input. When you try it yourself, a few problems come up often. First, the AI Agent node shows a red mark. The cause is almost always that the Chat Model isn't connected to the point below the agent. Second, a credential error message appears. Check that the API key was copied in full with no spaces, and that your account with the model provider still has credit or quota. Third, the chat gets no reply. Make sure the workflow is saved, then check whether the previous run is still going or stopped with an error. Fourth, the agent answers with made-up store data, such as a price that doesn't exist. For now that's normal, because the agent has no data and no instructions yet. We fix both of those in the next episodes.
Let's sum up how the agent decides. For every incoming message, the agent reads the chat text along with the last few messages from memory. Then it weighs: can I answer directly, or do I need a tool? If it needs one, it calls the tool that fits best. And this is important: the agent picks a tool based on its name and description. That's why in Episode 33 we write very clear tool descriptions. The tool's result is read. If it's not enough yet, for example the stock has been checked but the delivery fee is still unclear, the agent can call another tool. This loop can repeat several times within one message. Once it's sure, the agent answers. So one customer message can trigger zero, one, or several tool calls, depending on what is needed. Agents are exciting, but they aren't always the answer. If every form just needs to be saved to Sheets, use a regular workflow. It's cheaper, faster, and easier to check. If the flow is fixed but the content needs to be understood, such as summarizing customer emails every morning, a workflow with an AI step from Session 6 is enough. Use an agent when the questions vary and it needs to choose tools, like a customer chat that asks about stock, then the price, and then wants to order. And for high-risk matters like payments or refunds, hand them to a human. At Sunset Coffee, that's Dimas's job as the admin. The agent just passes the case along. This is the Session 7 map. Today, in Episode 31, we set up the agent skeleton: the trigger, agent, model, memory, and first tool. In Episode 32 we prepare the data source in Google Sheets: a Products tab with prices and stock, and an Orders tab for logging orders. In Episode 33 the agent gets three tools: checking products, logging orders, and sending notifications to Dimas. In Episode 34 we set up the memory and write the system instructions: the role, price rules, confirmation before logging, and when to hand over to Dimas. And in Episode 35 everything is tested from start to finish, from a customer asking about stock to an order logged in Sheets. Before we close the episode, check your work. The Admin Agent workflow is created and saved, and the Chat Trigger is connected to the AI Agent. The Chat Model is connected with a valid credential, and Simple Memory uses the session number from the Chat Trigger. Finally, the Calculator is attached and you have tried the three test messages: a greeting, a calculation, and a stock question. If everything is checked, your agent skeleton is ready for data.
Let's recap. The AI Agent node is the control center. The Chat Model is its brain, Memory is its recall, and Tools are its hands. Unlike Session 6, the agent decides on its own when to use a tool. Our agent can already think, but it doesn't know Sunset Coffee's stock and prices yet. In the next episode we prepare Google Sheets as its data source, with tidy Products and Orders tabs. See you in Episode 32.
Try these on your own after watching to lock in what you learned.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →