The AI Agent node goes beyond single-prompt LLM calls.
The AI Agent node goes beyond single-prompt LLM calls. It gives the model access to tools (other n8n nodes) that it can invoke autonomously to accomplish a goal. The agent decides which tools to call, in what order, and how to combine results -- making it suitable for open-ended research, data gathering, and multi-step processing tasks.
Real-world example: A research agent that takes a company name, searches the web for recent news, summarizes findings, and saves a briefing document to Google Docs.
Workflow structure:
[Webhook: company_name] → [AI Agent] → [Respond to Webhook]
│
Tools connected:
├── HTTP Request (web search API)
├── HTTP Request (fetch article content)
└── Google Docs (create document)
```text
AI Agent node configuration:
| Setting | Value |
|------------------|------------------------------|
| Agent Type | Tools Agent |
| Model | Claude Sonnet or GPT-4o |
| Max Iterations | 10 |
System prompt:
```text
You are a company research assistant. When given a company name:
1. Use the web_search tool to find 3-5 recent news articles about the company.
2. Use the fetch_article tool to get the full text of the top 2 results.
3. Synthesize a briefing with these sections:
- Company Overview (2-3 sentences)
- Recent Developments (bullet points from articles)
- Key Takeaways (3 bullets)
4. Use the save_to_docs tool to create a Google Doc with the briefing.
Be thorough but concise. Cite sources with URLs.
```text
Tool sub-workflows connected to the agent:
```javascript
// Tool: web_search — wraps SerpAPI or similar
// Input schema: { "query": "string" }
// Returns: array of { title, url, snippet }
// Tool: fetch_article — wraps HTTP Request + HTML extraction
// Input schema: { "url": "string" }
// Returns: { content: "article text" }
// Tool: save_to_docs — wraps Google Docs node
// Input schema: { "title": "string", "body": "string" }
// Returns: { doc_url: "https://docs.google.com/..." }
```text
> **Tip: Set Guardrails**
>
> Always set **Max Iterations** to prevent runaway loops. Start with 10 and adjust based on task complexity. Add a timeout using the workflow settings as a secondary safeguard.
The AI Agent turns n8n from a linear automation tool into a platform for building autonomous AI assistants.
**Related:** [Use Manual Trigger During Development Instead of Webhook or Schedule](../api-cost-optimization/01-use-manual-trigger-during-development-instead-of-webhook-or-schedule.md) | [Flatten Deeply Nested API Responses](../code-node-mastery/01-flatten-deeply-nested-api-responses.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.