Published

AI

Self-Host n8n and Build Your First AI Agent

n8n is a self-hostable workflow tool with an AI Agent node. Run it in Docker and build a chat agent that can use tools.

1. Run n8n

Start n8n with a persistent volume.

docker run -d --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n \
  --restart unless-stopped docker.n8n.io/n8nio/n8n

2. Open it

Browse to http://localhost:5678 and create the owner account.

http://localhost:5678

3. Build the agent

New workflow > add a Chat Trigger > add an AI Agent node > connect a chat model (OpenAI, Anthropic or a local Ollama model) with your credentials.

Chat Trigger -> AI Agent -> Chat Model

4. Give it tools

Add tools to the agent, for example HTTP Request, Google Sheets or a calculator, then chat with it to test.

AI Agent > Tools > HTTP Request

FAQ

Is n8n free?

The self-hosted Community Edition is free; n8n Cloud is paid.

Can it use a local model?

Yes. Point the chat model at Ollama to keep everything on your machine.