Creating AI Agents with n8n

Creating AI Agents with n8n

In a world increasingly shaped by automated processes, incredible possibilities are opening up for us. AI agents are no longer just a vision of the future; they are already here and offer a wide range of applications that can make our everyday lives considerably easier.

In this blog post, I show how we can use the software n8n to integrate intelligence into our projects in an impressive way with minimal effort. Let's look at how these agents work and what innovative possibilities they open up for us.

The Structure of an AI Agent

At its core, an AI agent is an intelligent control unit that directs various tools and executes tasks. Rather than having one large, powerful model handle every task itself, the agent delegates the work to specialized tools.

Think of a calculator: instead of having an AI model perform the calculations, it leaves this to a dedicated unit optimized for exactly that purpose. This separation of tasks ensures efficiency and clear structures. You can also imagine it as an orchestra, where each musician plays their own instrument and together they create a great work.

As software developers, we have worked according to the principle of divide and conquer for years. AI agents are no different. The tool itself does not necessarily have to be AI; it can also be a simple script or an API integration. This saves resources and makes the system more flexible. We can therefore decide which parts to equip with AI models and which not to.

an n8n agent

Another exciting concept is tools' multi-tenancy capability. Using a calendar tool as an example, we can see that it can not only be used generally but can also access specific calendars through simple configuration. Combining these capabilities lets us develop (or click together) both specialized and very general solutions.

My Personal Assistant (Agent)

Over the past few months, I have been experimenting quite a bit with my personal agent, which helps me organize my hectic everyday life better. It has access to my private calendar, can create appointments for me, send emails, retrieve data from my weather station, and even view documents from my document management system.

My personal agent

One particularly useful feature is the combination of tasks. Let's say I want to create an appointment to go shopping after Wormatia's next home game. My agent would then automatically look for a suitable gap in the calendar, create an appointment, and email me the details.

To make the assistant easy to use, I simply created an integration in Mattermost using a slash command. The slash command then triggers a webhook that starts the agent. This lets me delegate tasks quickly and easily and focus on what matters.

Mattermost integration

The example shows how the assistant retrieves the current data from my weather station and displays the result in a chat window, including a brief assessment created by the LLM (Large Language Model).

Creating Agents in n8n

Developing AI agents is an exciting journey, and n8n gives us the tools to quickly build prototypes that we can later turn into full applications. Each agent can have its own specialized LLM, which offers enormous scope for customizing its functions.

Choosing an LLM

Being able to swap models quickly can also be a major advantage. It allows you to test things quickly without depending on just one provider. Among other things, I also run Ollama in an LXC container, which is used by one or two of my agents as well.

n8n LLM selection

As you can see, n8n offers a wide selection of LLM providers.
Behind each provider is a list of models that are then available. Choosing the model is very important and should be carefully considered.

Depending on the model selected, the quality of the answers can vary. Speed and costs also need to be taken into account.

A model from market leader OpenAI is not always the best choice. When it comes to speed, the models offered by Groq are often a better choice.
I also find Google's offering interesting. As an individual, you get quite a generous free allowance, which is often sufficient for personal use.
Groq also offers a free allowance.

Code Tools

The ability to develop our own tools in the programming languages JavaScript or Python allows us to integrate almost any function we can imagine into an AI agent. This opens up opportunities not just for automation, but also for innovation extending into the field of machine intelligence.

n8n code tool example

Vector Databases

If specialized knowledge is needed that is not contained in the models, a vector database or another knowledge management system can also be connected. This lets the agent access specific information and incorporate it into its decisions.

n8n vector database selection

In my personal agent, for example, I have a connection to a Qdrant database that helps me search my documents and find relevant information. Here, too, n8n makes integration easy for me. The Qdrant vector database is just one example, and it offers the advantage of being self-hostable, which is a major benefit for sensitive data.

My colleague Elias Henrich also likes to call vector databases understanding databases, because they help AI understand the world better by providing additional information.

2025: The Year of AI Agents?

We are only at the beginning of AI agent development, and many see 2025 as the year of AI agents. The momentum in this field is sure to surprise us. I encourage every developer or technology enthusiast to explore n8n and the possibilities of AI integration.

Whether for personal projects or larger enterprise solutions – the possibilities are almost limitless. Now is the time to shape the future together and increase efficiency through intelligent automation. Whether you think that is good or bad no longer matters, because the agents are already here. So the next step is in your hands too – use the available tools and test your ideas to develop innovative solutions.

AI agents will probably also give rise to many new professions and cause old ones to disappear. Society needs to set the right course here as well and prepare people for the changes.
Seen this way, 2024 is already a year of AI agents too. In 2025, there will be many, many more of them. We will also use more and more agents without being aware of it. That is a good thing, because agents are supposed to make our lives easier, not more complicated.