n8n + AI Agents: Workflow Automation with Artificial Intelligence

# n8n + AI Agents: Automasi Workflow dengan Kecerdasan Buatan ## Pendahuluan n8n adalah platform workflow automation yang bersifat open-source dan dapat di-self-host, memungkinkan Anda menghubungkan...

By Ruby Abdullah · · tutorial
n8nWorkflow AutomationAI AgentNo-CodeIntegration

n8n + AI Agents: Workflow Automation with Artificial Intelligence

Introduction

n8n is an open-source, self-hostable workflow automation platform that allows you to connect various applications and services visually without writing much code. With the introduction of AI Agent features in n8n, the platform becomes significantly more powerful by enabling integration of Large Language Model (LLM) capabilities from OpenAI and Anthropic directly into your workflows.

In this tutorial, we will learn how to use n8n from installation, basic workflow concepts, to building an automated customer support pipeline powered by AI. This tutorial is suitable for developers, data engineers, and anyone looking to automate business processes with artificial intelligence.

Prerequisites

Before getting started, make sure you have:

  • Docker and Docker Compose installed (for self-hosted deployment)
  • Node.js v18+ (for npm installation)
  • API key from OpenAI or Anthropic
  • Basic understanding of REST APIs and JSON

Installing n8n

Docker is the easiest and most reliable way to run n8n on your own server.

# Create a directory for n8n

mkdir n8n-docker && cd n8n-docker

Create docker-compose.yml file

cat > docker-compose.yml << 'EOF'

version: '3.8'

services:

n8n:

image: docker.n8n.io/n8nio/n8n

restart: always

ports:

  • "5678:5678"
environment:

  • N8NBASICAUTHACTIVE=true
  • N8NBASICAUTHUSER=admin
  • N8NBASICAUTHPASSWORD=securepassword
  • N8NHOST=localhost
  • N8NPORT=5678
  • N8NPROTOCOL=http
  • GENERICTIMEZONE=Asia/Jakarta
volumes:

  • n8ndata:/home/node/.n8n

volumes:

n8ndata:

EOF

Start n8n

docker compose up -d

Once the container is running, open your browser and navigate to http://localhost:5678. You will see the n8n initial setup page.

Method 2: Installation via npm

If you prefer running n8n directly without Docker:

# Install n8n globally

npm install -g n8n

Start n8n

n8n start

Or start with tunnel for webhook testing

n8n start --tunnel

To run n8n as a background service on Linux, you can use pm2:

npm install -g pm2

pm2 start n8n

pm2 save

pm2 startup

Basic Workflow Concepts

Nodes

A node is the fundamental unit in n8n. Each node performs one specific task, such as sending an HTTP request, processing data, or interacting with external services. There are several types of nodes:

  • Trigger Nodes: Start workflows (e.g., Webhook, Schedule, Email Trigger)
  • Regular Nodes: Process data (e.g., HTTP Request, Code, IF)
  • AI Nodes: Interact with AI models (e.g., AI Agent, LLM Chain)

Connections

Connections link the output of one node to the input of another. Data flows through connections as JSON items. Each item is a single unit of data being processed.

[

{

"json": {

"name": "John",

"email": "john@example.com",

"message": "I need help with my order"

}

}

]

Triggers

Triggers determine when a workflow runs. Some commonly used triggers include:

  • Webhook Trigger: Runs the workflow when an HTTP request is received
  • Schedule Trigger: Runs the workflow on a specific schedule (cron)
  • Email Trigger: Runs the workflow when a new email is received
  • Manual Trigger: Runs the workflow manually from the editor

Setting Up AI Agent Nodes

Adding Credentials

Before using AI nodes, you need to add credentials for your LLM provider. Go to Settings > Credentials and add:

Related Articles

Smolagents: Lightweight AI Agent Framework by HuggingFace

Smolagents: Framework AI Agent Ringan dari HuggingFace Pendahuluan Smolagents adalah framework AI agent yang ringan dan ...

Phidata (Agno) Tutorial: Build Powerful AI Agents with a Simple Framework

Tutorial Phidata (Agno): Framework AI Agent yang Simpel dan Powerful Membangun AI agent yang cerdas dan otonom kini sema...

CrewAI Tutorial: Building Multi-Agent AI Framework

CrewAI - Framework AI Multi-Agen Daftar Isi Pendahuluan Prasyarat Instalasi dan Pengaturan Konsep Dasar 5...

Reflex Tutorial: Building Full-Stack Web Apps in Pure Python

Reflex: Membangun Aplikasi Web Full-Stack dengan Python Murni Reflex memungkinkan Anda membangun aplikasi web lengkap — ...