Memuat
Memuat
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 #29: Practice: An AI Step to Summarize and Categorize”.
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 Episode 29. Our Sunset Coffee order workflow already has a trigger from the form, complete with four test entries. Today we add its brain: an AI step that summarizes each order and gives it a category. We'll also learn to store the API key safely, write a prompt for a workflow, and ask for a structured answer.
Let's look again at the notes from our four test entries. Rina's note: deliver in the afternoon please. For ordinary automation, this is just text. AI understands that it's a regular order with a delivery time request. Andi's note: is there a sugar-free version? An ordinary rule still just sees text. AI understands that it's a question waiting for an answer. Joko's note: yesterday's coffee spilled on the way and he's disappointed. AI recognizes that it's a complaint, and picks up on how the customer feels. And Putri's note: for an office event tomorrow at eight in the morning. AI understands there's a close deadline, so this order is urgent. You might ask, why not just use keyword rules, for example the word spilled means a complaint? The problem is that customers write in a thousand ways: spilled, leaking, messy, not what I ordered. Keyword rules miss easily, while AI reads the meaning. So our AI step has four jobs. First, receive the order data from the form node: name, order, and notes. Second, the AI model reads and understands it, like an experienced admin reading customer chats. Third, write a one-sentence summary, so Dimas can understand the order at a glance. Fourth, give one of four categories: Regular order, Question, Complaint, or Urgent. The output must be tidy and consistent, because in Episode 30 each part is saved to a spreadsheet column.
Before the AI node can work, n8n needs permission to use an AI model from a provider like OpenAI, Anthropic, or Google. That permission takes the form of an API key, a long string of letters and numbers. Think of an API key like your ATM PIN. Whoever holds it can use the AI service in your name, and the bill goes to your account. So this key must be protected. Getting one is similar with every provider. Sign in to the developer platform of the AI provider you've chosen. This is different from the regular chat app, and a chat subscription doesn't automatically give you an API key. Add a payment method. API costs are charged per use, not as a fixed monthly subscription. Some providers also give a limited free quota. Because prices change often, check the latest pricing page. Then create a new API key and give it a clear name, for example n8n Sunset Coffee. The name helps you know which key is used where. If available, set a monthly usage limit. That way, if a mistake makes the workflow run thousands of times, your bill stays under control. Finally, copy the key. Many providers only show the key once, so paste it straight into n8n. Don't keep it in notes, chats, or ordinary documents. In n8n, keys are stored in the Credentials section. Create a new credential, choose the type that matches your provider, for example OpenAI, and give it an easy-to-recognize name. Paste the API key into its box, then save. n8n tests the connection and shows a success message. Notice that the key is immediately hidden behind dots. Credentials are stored encrypted, and the workflow only refers to the credential's name. If you ever share or export the workflow, the key doesn't go with it. Let's be clear about the rules. Store your API key only in the n8n Credentials menu. Never paste an API key into a prompt, a chat with AI, or your team's WhatsApp group, including when asking a friend to help fix a workflow. Don't take screenshots or record your screen while the key is visible. Many keys leak through tutorial images. Create one key for one purpose. If one key leaks, you just revoke that key on the provider's platform without affecting the others. And in the first month, check your usage bill once a week. For summarizing short orders, the cost per execution is usually small, but you need to see the numbers for your own business. If a key does leak, don't panic. Revoke that key on the provider's platform, create a new one, then replace the value in n8n Credentials. The workflow doesn't need changing, because it only refers to the credential's name.
Back to the Sunset Coffee Orders workflow. The Order form node still has its green check and holds the test data we pinned. Click the plus sign to the right of the form node, type AI in the search box, then choose Basic LLM Chain. Rename it to Summarize and categorize. Basic LLM Chain is the simplest AI node. It takes a prompt, sends it to a model, and outputs the answer. No tools, no memory. Exactly what we need for a one-shot task like this. AI node names may differ slightly between versions. There are also provider-specific nodes, for example the OpenAI node with an operation that sends a message to a model. The principle is the same: prompt in, answer out. Below the AI node is a connection point labeled Model. Click it, then choose the chat model for your provider, for example OpenAI Chat Model, Anthropic Chat Model, or Google Gemini Chat Model. In the chat model settings, choose the credential you just created, then choose the model. For summarizing and categorizing short orders, a small, economical model is enough. In the additional options there's the sampling temperature. A low value, for example zero point two, makes answers more consistent, which suits categories. A high value is more creative, which suits caption ideas. Notice the dashed purple line. It shows that the model is part of the AI node, not a separate step. The order data still flows along the main line from the form to the AI node. For Make users, the equivalent is a module from the AI provider, for example the OpenAI module for creating an answer. The credential is called a connection, and you store it the same way: once, in a dedicated place.
A prompt inside a workflow is a little different from a prompt in a chat. First, nobody replies. In a chat, you can say please fix it. In a workflow, the prompt must be complete in one go. Second, the data changes with every order. So the data part is filled with dragged fields, not text typed in once. Third, the answer is read by a machine, not a person. The next node expects the same shape every time. An answer that's a paragraph today and a table tomorrow will break the flow. Now we write the prompt using the structure from Session 2. The role: you are the admin of Sunset Coffee, a coffee shop in Bandung, reading orders from the form. The task: write a one-sentence summary, then pick one category from four options. The word one is written firmly, so the AI doesn't answer with two categories at once. The context holds definitions. Urgent means there's a deadline today or tomorrow morning, or a large amount for an event. Complaint means an issue with a previous order. Definitions like these make the AI judge by the same standard as Laras. The limits: don't make up prices or stock, and don't copy the WhatsApp number into the summary. Personal data only needs to be kept in its own column. And the data part holds three dragged fields: Name, Order, and Notes. The expressions read: take the value of the Name column, the Order column, and the Notes column from the incoming data. Notice that we're not asking the AI to write a reply to the customer or send anything. Its job is only to read and judge. The action stays with Dimas. A narrow task makes the results more reliable. Open the Summarize and categorize node. For the prompt source, choose Define below, which means we write the prompt ourselves here, because the trigger is a form, not a chat window. Type the role through the limits, then for the data part, drag the Name, Order, and Notes fields from the input panel. The prompt box changes color because it now holds expressions. Look at the preview under the box. For Sari's item, the prompt is fully filled in: the name Sari, three one-liter palm sugar iced coffees, and the note about sending tomorrow. This is what's actually sent to the model. Click Execute step. The AI node turns green, and its output holds one text answer. The content is right, but the shape is still a free sentence. That's what we'll tidy up in the next step. An easy way to see a workflow prompt: think of it as an SOP, a standard operating procedure, for a new employee who's very diligent but doesn't know your shop yet. A new employee needs a clear task, clear definitions, and clear limits. If the SOP is tidy, the work is tidy too, day or night.
That free answer had the right content, but its shape was a paragraph, and its style can change every time. A structured answer always has the same fields: summary and category. For example, a free answer might say looks like this is a complaint. A structured answer just holds category: Complaint. Short, certain, and easy to check. Most importantly, a structured answer can be saved straight to a spreadsheet: one field for one column. A free answer has to be cut up by hand, which is exactly the work we want to get rid of. Open the Summarize and categorize node again, and turn on Require Specific Output Format. This means we require the AI to answer in a specific shape. A new connection point appears below the node: Output Parser. Click it, then choose Structured Output Parser. Rename it to Answer format. In its settings, choose Generate From JSON Example, then paste an example answer. Think of this as a blank form the AI has to fill in, complete with sample entries. There are three fields. Summary holds one sentence. Category holds one of the four options. And needs reply holds yes or no, which later helps Dimas know which orders to answer first. You don't need to understand the brackets and quotation marks. Just copy the pattern from the example, then change the field names and sample values. We still list the four categories in the prompt, so the AI knows the options. Now run Execute step again. The AI node, the model, and the parser are all green. The dashed lines show that both work as part of the Summarize and categorize node. One note: if the AI ever answers outside the requested shape, this node can fail and show an error message. That's actually good, because messy data doesn't get saved. We'll practice reading errors in Episode 30.
Look at the output panel. The AI's answer is now neatly arranged inside a field called output, with three parts: summary, category, and needs reply. The summary for Sari: orders three one-liter palm sugar iced coffees, wants it sent tomorrow and will pay by transfer. One sentence, and Dimas gets it right away. The category is Regular order, and needs reply is false, because there's no question. Dimas just processes this order as usual. Select Andi's item in the panel. The summary: orders one hampers package and asks whether there's a sugar-free version. The category is Question, and needs reply is true. Dimas knows this order needs an answer before it's processed. Joko's item is interesting too. The summary mentions the spilled coffee complaint, the category is Complaint, and needs reply is true. The AI doesn't promise any compensation, because that's Laras's decision, not the AI's. Remember where these fields are: summary and category sit inside output. In Episode 30, when we map the spreadsheet columns, we'll drag fields from inside this output. As for cost, an execution like this uses only a little text, so the cost is small. But you'll only know the exact number after checking your usage bill on the provider's platform. Now test the four test entries one by one. Rina: orders two one-liter palm sugar iced coffees, afternoon delivery. Category Regular order. As expected. Andi: orders one hampers package and asks about a sugar-free version. Category Question, and needs reply is true. As expected. Joko: orders cold brew while complaining that yesterday's coffee spilled. Category Complaint. As expected. Putri: five hampers for an office event tomorrow at eight in the morning. Category Urgent. All four match the expected column we wrote in Episode 28. The wording on your screen may be slightly different, because AI doesn't write exactly the same way every time. What matters is that the category is right and the summary doesn't add information that isn't in the order. What if the AI gets it wrong, for example a question treated as a regular order? First step, clarify the category definitions in the prompt. Mistakes usually come from vague definitions. Second, add one or two example orders with their categories, like the example technique from Session 2. Third, lower the sampling temperature so answers are more consistent. Fourth, keep a human in the loop. Dimas personally checks every order categorized as Complaint or Urgent, because these two categories are the most costly when they're wrong. And what you must not do: trust it one hundred percent without ever checking. In the first week, compare the AI's categories with your own judgment, for at least ten orders. Before Episode 30, finish these four things. First, create an API key with your chosen provider and store it in n8n Credentials. Second, add the Basic LLM Chain node, a chat model, and the Structured Output Parser, as shown on screen. Third, test all four test entries and note their categories. If any miss, fix the prompt until all four are right. Fourth, save the workflow, and keep the test data pinned. We'll use it to set up the Google Sheets and Gmail nodes.
Let's sum up. We stored the API key safely in Credentials, added the Basic LLM Chain node with a chat model, wrote a prompt filled in automatically from the form, and forced the answer into a tidy shape with the Structured Output Parser. In the next episode, we finish the workflow: saving the results to Google Sheets, sending an email notification to Dimas with dynamic content, handling errors, and then activating the workflow. See you in Episode 30.
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 →