AI Workflow Demo

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In this demo, you’ll learn how to create a workflow with n8n. This workflow doesn’t just write text, it researches a live topic on the web, analyzes the facts, and formats the output for a specific social media audience. If you get stuck at any point, you can import the workflow into your n8n workspace from the starter project by clicking the three horizontal dots to the right of the history button at the top-right corner of the screen.

You’ll start the workflow by asking a question in a chat. This triggers an LLM to use a search engine as a tool to find relevant information where necessary and post the results to a bin.

n8n, and most of the workflow platforms you read about earlier work based on the same graph principles of nodes and edges. They have a starting point, paths, decision points, and an exit or an infinite loop based on your design.

While you can create a free account online to get started with n8n, for this demo, install n8n locally with the following command:

npm install n8n -g

That’s all you need to get n8n. You may visit n8n.io/hosting if the other installation options will suit you better than installing with npm.

Enter n8n on the terminal to start it, and visit http://localhost:5678 in your browser to access it.

For a new installation, you’ll be presented with a form to fill out. Complete them, then you’ll be presented with a fresh canvas. Name your workflow “LinkedIn workflow”.

Start the workflow with a trigger node by clicking the + button above the “Add first step…” on the canvas. In the text box that opens to the right, search for “Chat Trigger”, and select it. This opens a configuration dialog for the selected node, allowing you to customize it for your needs. You don’t need to make any changes, so close it. This node creates a small chat window in your browser. When you type a topic here, it kicks off the entire workflow.

Then, click the + sign at the end of the Chat Trigger node on the canvas, to add the next node. This time, search and add the AI Agent node. In the dialog window for this node, under “Parameters > Options”, click “Add Option” and select “System Message”, to set a custom system prompt for the LLM that will be used by this node.

You are a social media expert. Your job is to research the user's topic using the provided search tool, find 3 interesting facts, and write a viral-style LinkedIn post with emojis and hashtags.

Go ahead and close the configuration window. Below the AI Agent node, you can see Chat Model, Memory and Tool connectors. These are extra things you can provide to this node, with Chat Model being required. Click the + button under Chat Model, and select OpenAI Chat Model from the model selection window. Click “Create new credential” under “Parameters” to add your OpenAI API key. Under Model, the latest will be selected by default, leave it as it is, and close the dialog window.

For the Memory connector, select “Simple Memory” and leave every other option at the default when the configuration window opens. This will help your Agent to remember past interactions and responses.

Before you add the Tool node, click the + button at the top right corner of the canvas to install the tool you’ll be using. Search for “SerpAPI Official” and install it. Now, click the + button on the Tool connector, and search for the tool you just installed. Visit serpapi.com to create a free account. This tool allows the AI Agent to search Google using an API, otherwise, your workflow will be stuck with dated information from the LLM’s training data. The free tier is enough for this demo. Copy the API key and paste it into the Credentials box in the configuration dialog window.

Leave everything else at the default setting. Sometimes, the Search Query box in the configuration may contain text like Coffee by default. This is set by default to enable you to quickly test the tool. But in this case, it’ll confuse your agent if you’re asking about one thing from the chat node, and asking about Coffee too. The hardcoded search query will override the input to this node. To avoid this, remove it, and instead click the box at the end of that input box to let the model automatically define the parameter. That’s it, your AI Agent is all set now.

Wrap it up by connecting a node that receives the output from the AI Agent node. Click the + button to the right of the AI Agent node, search and add Postbin, and select “Send a request”. This node has a wall for each API key that resets every 30 minutes. Visit postb.in and click the “Create Bin” button to acquire an API, and paste it the Bin ID textbox in the Postbin node’s configuration dialog window. To show the response it receives, enter {{ $json.output }} in the “Bin Content” text box. Close the dialog window.

Your setup is now complete. To start the workflow, type your question in the chat window at the bottom-left of the canvas and watch your agent get to work. n8n provides helpful visuals and logs that show how data flows between nodes and edges until the final output is produced. Once it’s complete, visit your Postbin page to view the results.

That’s all for this demo. Keep reading to learn about some more AI platform categories.

See forum comments
Download course materials from Github
Previous: Reviewing AI Platforms: Part 1 Next: Reviewing AI Platforms: Part 2