AI Agents with n8n

Want to automate tasks in your homelab or explore what AI agents can do? n8n is a free, open-source automation tool that runs perfectly on a Raspberry Pi 5. With it, you can build smart workflows that connect APIs, trigger actions, and even control AI agents like ChatGPT.

What You Can Do with n8n

  • Trigger AI responses with webhooks
  • Connect apps like Gmail, Telegram, or Google Sheets
  • Automate reports, alerts, backups, and file processing
  • Build AI workflows that take action on your data

No coding is required, but you can use JavaScript and expressions if you want more control.


Install n8n on Raspberry Pi 5 (with Docker)

1. Install Docker

sudo curl -fsSL https://get.docker.com -o get-docker.sh 
sudo sh get-docker.sh
sudo reboot

2. Add User to Docker Group

sudo groupadd docker && sudo usermod -aG docker $USER
sudo reboot

3. (Optional) Install Portainer for GUI Management

docker run -d -p 9000:9000 --name=portainer --restart=always --pull=always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /data/portainer_data:/data \
  portainer/portainer-ee:latest

4. Prepare Data Folders

sudo mkdir -p /data/n8n_data /data/compose/n8n
sudo chmod -R 777 /data

5. Create docker-compose.yml

Save this in /data/compose/n8n/docker-compose.yml:

services:
  n8n:
    image: n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:
      - TZ=Europe/Copenhagen
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=xxxxxxxxxxxx
      - N8N_HOST=10.168.0.277
      - N8N_PORT=5678
      - N8N_SECURE_COOKIE=false
    volumes:
      - /data/n8n_data:/home/node/.n8n

⚠️ Replace the IP address with your Raspberry Pi’s actual IP.

6. Launch n8n

cd /data/compose/n8n
docker compose up -d

Now open your browser:

http://10.168.0.277:5678


n8n + AI agents = powerful automation. Run it in your homelab and take full control of your workflows.