BiTree
  • Search For Lessons
  • Curriculum
  • Pricing
  • For Educators
  • Become a Tutor
  • About
  • Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
BiTree

Live coding lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Search For Lessons
  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Become a Tutor
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 BiTree. All rights reserved.
Curriculum/AI Agents/No-Code Agents/Building Your First n8n AI Agent
60 minBeginner

Building Your First n8n AI Agent

After this lesson, you will be able to: Connect an LLM node to tool nodes in n8n's AI Agent loop and build a working agent that answers real-world queries.

Now we make it intelligent. The n8n AI Agent node accepts a chat input, an LLM, memory, and a list of tools, it runs the ReAct loop for you. We'll wire one up with a web search tool and a calculator, and watch it reason through real questions.

Prerequisites:n8n: Visual Drag-and-Drop Workflow Automation

💡 API key prep

You need an LLM API key. Anthropic ($5 free credit at signup) or OpenAI both work. Save it as an n8n credential, never paste it directly into a node.

Build the agent

  1. 1

    1. New workflow. Add a 'Chat Trigger' node, this gives you a chat UI to test in.

  2. 2

    2. Add an 'AI Agent' node. Connect the trigger to it.

  3. 3

    3. Below the AI Agent: connect a 'Chat Model' (sub-node). Pick Anthropic or OpenAI Chat Model. Add your credential.

  4. 4

    4. Below the AI Agent: connect a 'Memory' sub-node. Pick 'Window Buffer Memory'.

  5. 5

    5. Below the AI Agent: connect a 'Tool' sub-node. Add 'SerpAPI' (or 'Wikipedia', free, no key).

  6. 6

    6. Add another tool: 'Calculator'.

  7. 7

    7. Open chat (button on Chat Trigger). Ask: 'What's the population of Japan times the population of Canada?'

What just happened

The agent saw your question, decided it needed Wikipedia (population of Japan), called the tool, observed the result, called Wikipedia again (Canada), called the calculator with both numbers, and answered. Click 'Logs' on the AI Agent node, you can see every reasoning step.

Diagram coming soon!

n8n canvas with Chat Trigger → AI Agent, with Chat Model, Memory, Wikipedia, Calculator hanging below the AI Agent as sub-nodes

💡 System prompt = personality + rules

The AI Agent node has a 'System Message' field. This is where you set the agent's role, tone, and constraints. 'You are a helpful research assistant. Always cite the source URL when you use a tool. Never guess, say I don't know.' Tighter system prompts = more reliable agents.

Add a real-world tool

  1. 1

    1. Add an 'HTTP Request' tool. Configure it to hit a real API (e.g., https://api.coingecko.com/api/v3/simple/price).

  2. 2

    2. Give it a name and description: 'getCryptoPrice, fetches the current price of a cryptocurrency. Input: the crypto id (e.g. bitcoin).'

  3. 3

    3. The agent reads that description and decides when to use the tool.

  4. 4

    4. Ask: 'What's bitcoin's price right now in dollars?'

Sign in and purchase access to unlock this lesson.

Sign in to purchase
←n8n: Visual Drag-and-Drop Workflow Automation
Back to No-Code Agents
Zapier: Automation + AI Steps→