Learn › n8n AI Agents: Build Intelligent Automation › Your First AI Agent: A Research Assistant

Your First AI Agent: A Research Assistant

Intermediate 🕐 15 min Lesson 3 of 14
What you'll learn
  • Build a complete research assistant agent end-to-end in n8n
  • Configure the Chat Trigger and understand the built-in chat interface it provides
  • Connect a Tavily Search tool and observe how the agent decides to invoke it
  • Read and interpret an AI Agent execution trace for debugging

What You Are Building

A research assistant agent that can search the web, synthesise findings, and answer questions in plain language. You will connect a Chat Trigger, an AI Agent with a Tavily Search tool, and a response — all without writing any code. This is the canonical first n8n AI Agent: simple enough to understand fully, useful enough to keep running.

Step 1: Add a Chat Trigger

Create a new workflow. Add an n8n Form Trigger or an n8n Chat Trigger node as the start. The Chat Trigger provides a built-in chat interface at a URL like https://your-instance.n8n.cloud/webhook/your-id/chat — no frontend required. It fires each time someone sends a message and passes the message text into the workflow as $json.chatInput.

Step 2: Add the AI Agent Node

After the Chat Trigger, add an AI Agent node. In the node's settings, write a system prompt that defines the agent's role:

"You are a research assistant. When given a topic or question, search the web for current, accurate information and provide a concise summary with key findings."

Leave the Prompt field set to Auto — this means the agent automatically uses the incoming chat message as its input.

Step 3: Connect a Chat Model

Click the Chat Model input on the AI Agent node and add an OpenAI Chat Model sub-node (or your preferred provider). Select gpt-4o-mini for a cost-effective start — it handles research tasks well. Set temperature to 0.2 for consistent, factual responses. Add your API key as a credential.

Step 4: Add a Search Tool

Click the Tools input on the AI Agent node and add a Tavily Search sub-node. Tavily is a search API built specifically for AI agents — it returns clean, structured results optimised for LLM consumption. A free tier is available at tavily.com for low-volume use. Add your Tavily API key as a credential.

Step 5: Run and Test

Save the workflow and activate it. Open the Chat Trigger URL and send a message such as "What are the most recent developments in AI regulation?" Watch the execution panel — you can observe the agent thinking, calling the search tool, reading the results, and composing a response. The agent may call the search tool multiple times if initial results are insufficient.

Reading the Execution Trace

Click on the AI Agent node in the execution view to see the full reasoning trace. Each step is logged: what the model decided to do, which tool it called, what arguments it passed, and what the tool returned. Learning to read this trace is the fastest path to understanding why an agent behaved a certain way — and the foundation of debugging more complex agents later.

What to Try Next

  • Add a Calculator tool alongside Tavily — the agent uses it automatically when arithmetic is needed.
  • Specialise the system prompt for a specific domain: competitor monitoring, technical documentation lookup, or news briefing.
  • Add a Window Buffer Memory sub-node so the agent remembers earlier messages in the same conversation.
Key takeaways
  • The n8n Chat Trigger provides a hosted chat UI at a webhook URL — no frontend code required
  • Tavily Search is built for AI agents and returns clean structured results without ads
  • The agent may call a tool multiple times in one reasoning loop if the first results are insufficient
  • Reading the execution trace before assuming something is broken is always the right first step