n8n AI agent setup: build a guarded lead qualifier
Follow this n8n AI agent setup to qualify inquiries against an approved service sheet, draft replies, and keep customer contact under human control.

This sheet contains partner links. A purchase through one earns Runbook a commission at no additional cost to you. How we make money.
In about 60 minutes, you'll have an n8n AI agent setup that checks an inbound inquiry against your approved service sheet and drafts the next reply. The stack is n8n, Google Sheets, and an OpenAI chat model. A salesperson reviews every answer, so the agent cannot quietly promise work, change a record, or contact a customer.
What you'll build
Your finished workflow accepts a pasted customer inquiry in an internal chat. It looks up the services, locations, and booking rules you keep in Google Sheets. Then it returns four things:
- Whether the request appears to fit your business.
- Which facts are still missing.
- The next question a salesperson should ask.
- A reply draft grounded in the sheet.
An AI agent is a workflow step that can decide when to use a connected tool. Here, that tool has one narrow job: read the approved service sheet. The agent does not get a send-email button, a payment tool, or permission to edit customer records.
That boundary matters more than the model. n8n's current AI Agent documentation says the node needs a chat model and at least one tool. It also says old agent-type settings were deprecated from n8n 1.82.0. Use the current AI Agent node, not an old tutorial built around a retired agent choice.
Your move
If you still need to choose an automation platform, compare n8n with Make and n8n with Zapier before moving this build. If n8n is already in place, continue.
Stack and source sheet
You need these pieces:
- n8n Cloud or a maintained n8n installation: automation software that passes information between your business tools.
- Google Sheets: one spreadsheet containing only approved facts the agent may use.
- OpenAI Chat Model: the n8n step that sends the request to an OpenAI language model, meaning software that generates and interprets text.
- Five to ten test inquiries: invented examples that cover good fits, poor fits, missing details, and wording the agent must refuse to guess.
Create a Google Sheet named Agent Service Rules. Rename the first tab Services. Put these headings in row one:
| service | service_area | minimum_job | booking_rule | notes |
|---|---|---|---|---|
| Drain clearing | North and East areas | Call for assessment | Same-day subject to availability | Do not quote before inspection |
| Water heater replacement | All areas | Site visit required | Appointment required | Confirm fuel type and tank size |
Replace the examples with your real rules. Avoid customer names, private notes, card details, health information, and anything the agent does not need. Treat this sheet as the approved source, not a dumping ground.
n8n's Google Sheets node guide confirms that Get Row(s) reads sheet data and that the node can work as an AI tool. Read access is enough for version one.
Steps
1. Start with the internal chat trigger
Open n8n and select Create Workflow. Name it Internal Lead Qualifier. Select the plus button on the canvas, search for Chat Trigger, and add it.
Leave Make Chat Publicly Available turned off while you build. The manual chat panel inside n8n is enough for testing. n8n's Chat Trigger documentation specifically advises leaving public access off during construction.
Connect Chat Trigger to a new AI Agent node. A trigger is the event that starts an automation. In this workflow, each message is the event.
2. Connect the OpenAI model
On the AI Agent node, select the Chat Model connector. Choose OpenAI Chat Model. In Credential to connect with, select an existing approved credential or follow n8n's prompt to add the API key issued for this workflow.
An API key is a secret password one application uses to call another. Store it in n8n's credential field. Do not paste it into the prompt, the workflow name, a note on the canvas, or the Google Sheet.
Select a model available to your account. Set a modest Maximum Number of Tokens, which caps the length of the generated answer, if that option appears for your model. You do not need a long response for lead triage.
3. Add Google Sheets as the only tool
Select the Tool connector on AI Agent. Search for Google Sheets Tool and add it. Configure:
- Credential to connect with: the Google account allowed to read the service sheet.
- Resource: Sheet Within Document.
- Operation: Get Row(s).
- Document: Agent Service Rules.
- Sheet: Services.
Do not give this Google credential editing access if a read-only sharing arrangement fits your account setup. The workflow only needs the rows returned by the sheet.
Rename the node Read approved service rules. In its tool description, state: Use this tool to read approved services, service areas, booking rules, and notes. Never treat missing information as approval. Clear names help the agent decide when the tool applies.
4. Paste the operating instructions
Open AI Agent. Find Options, choose Add Option, and add System Message. A system message is the standing instruction that controls how the agent handles every request.
Paste this, then replace the bracketed business label:
You are the internal lead-qualification assistant for [BUSINESS].
For every inquiry:
1. Read the approved service rules with the connected tool.
2. Use only facts returned by that tool and facts in the inquiry.
3. Never invent price, availability, coverage, timing, guarantees, or technical advice.
4. If a required fact is missing, label it UNKNOWN and ask one direct question.
5. Do not claim that a booking is confirmed.
6. Do not tell the operator to send a reply automatically.
Return exactly:
FIT: Likely / Unclear / Not listed
KNOWN: factual details supplied by the customer
MISSING: details needed before the next step
NEXT QUESTION: one question for the customer
DRAFT: a short reply for a person to review
If the request concerns danger, injury, gas, fire, flooding, or another emergency,
do not troubleshoot. Mark FIT as Unclear and tell the operator to follow the
business's emergency procedure.
The fixed format makes weak output easier to spot. It does not guarantee truth. The sheet, test cases, and human reviewer supply the control.
5. Test decisions, not friendly wording
Select Chat at the bottom of the editor. Run at least five invented inquiries. Include one clear match, one service outside your area, one request with no location, one demand for a price absent from the sheet, and one emergency.
Use a table to record the result:
| Test | Expected result | Pass condition |
|---|---|---|
| Listed service and area | Likely | Uses the matching row and asks only for missing details |
| Area absent from sheet | Unclear | Does not claim coverage |
| Price demanded | Unclear | Does not create a quote |
| Emergency wording | Unclear | Gives no technical troubleshooting |
| Unlisted service | Not listed | Does not bend a nearby service into a match |
Open the workflow's execution record after each run. An execution is one complete run saved by n8n. Confirm that the agent called Read approved service rules and inspect what the sheet returned.
6. Control access and cost
Keep the chat inside n8n for employees who already have appropriate access. If you later switch on Make Chat Publicly Available, choose Hosted Chat and set Authentication to Basic Auth or n8n User Auth rather than leaving an internal helper open to anyone.
Watch volume. n8n documents that every message received by Chat Trigger starts one workflow execution. A ten-message conversation therefore uses ten executions, before counting the separate model provider's usage. Read the n8n pricing explanation and set a monthly review based on actual execution history.
Do not add memory yet. Memory is stored conversation context that lets the agent recall earlier messages. It helps multi-message chats, but it also makes testing harder because an old answer can affect a new one. A single pasted inquiry gives you cleaner evidence during the first week.
The part that breaks
The sheet goes stale first. A manager changes a service area or booking rule somewhere else, but the agent keeps reading yesterday's row with complete confidence.
Put owner and reviewed_at columns in the sheet. Once a month, the owner checks every row and writes the date. Tell the agent to return Unclear when either field is blank. That turns missing upkeep into a visible stop instead of a fabricated answer.
The second failure is accidental authority. Someone attaches an email, calendar, or customer-management tool and assumes the prompt will prevent a bad action. A CRM is the software that stores customer details and runs follow-ups. Editing it is a bigger permission than reading a sheet.
n8n supports human review before a tool runs. In the AI Agent node, open the Tools connector, find Human review, choose an approval channel, and connect the risky tool beneath that review step. The workflow pauses until a person approves or denies the proposed action. Use that control if you later add sending or record changes.
Upgrade path
After a week of clean tests, add Simple Memory only if staff need a continuing conversation. In Chat Trigger, set Load Previous Session to From Memory. Connect the same memory node to both Chat Trigger and AI Agent so both steps use one conversation history. Keep the context window short and repeat your original tests.
Next, add a second Google Sheet tab named Test Log and record the expected result for every test inquiry. Re-run that set after changing the prompt, model, sheet columns, or n8n version. This is a regression test, meaning old cases must still work after a change.
Only then consider a tool that creates a draft task in your CRM. Put it behind human review, map the agent's result into clearly labeled fields, and test with fake records. Keep customer messaging manual until the approval record shows that the proposed recipient and exact text were checked.
If this workflow will run on your own server, complete the n8n self-hosting setup before it touches business data. Otherwise, browse the next automation runbook and build the manual review step around the process that costs your team the most rework.
Frequently asked questions
What do you need for an n8n AI agent setup?
You need n8n, a supported chat model, one connected tool, clear instructions, test inquiries, and a person responsible for reviewing the output.
Can an n8n AI agent send messages to customers?
It can when you connect a messaging tool, but the safer first build only drafts a reply and leaves sending to a person.
Does every chat message count as an n8n execution?
Yes. n8n documents that each message received by the Chat Trigger starts the workflow and uses one execution from the plan allowance.
Should you give an n8n AI agent memory?
Use memory only when the agent must remember earlier messages in the same conversation, and test that the same session identifier reaches every connected memory node.
About Runbook
AI tools and automation builds for marketers. What to use, how to wire it, and the workflow to copy this week. How we work
GET THE NEXT DISPATCH
Run the next build before your competitors read about it.
One short email when an AI tool or automation actually changes the work, with the build to copy.
No send unless there is a build worth running.
// keep_reading
Related builds

ChatGPT texts, n8n adds shared memory: Aug. 21
ChatGPT can send Apple Messages, n8n adds shared customer memory, and Google lets people tune Discover. Here is what to rewire today.

n8n opens MCP, Google adds Ads insights: Aug. 11
n8n opens one-click AI connections, Google adds Ads insights, and Claude marks generated work. Here is what to rewire today.

Google agents expand, GitLost warns: July 8 dispatch
Google's Gemini agent update, GitLost's repo-leak warning, and n8n's memory guidance change how you wire AI agents.