AI Prompt Task¶
Overview¶
The AI Prompt Task uses artificial intelligence to generate content, analyze text, extract information, classify data, or answer questions. You choose the model — from OpenAI, Anthropic or Google — and it brings advanced language understanding to your workflows.
When to use this task:
- Generate personalized email content
- Analyze customer sentiment
- Extract structured data from unstructured text
- Classify leads or support tickets
- Summarize long content
- Answer customer questions
- Translate languages
- Create product descriptions
- Draft responses or proposals
Key Features:
- Models from OpenAI, Anthropic and Google
- Summary, sentiment, data extraction, custom prompts, a chat agent, and transcription
- Context from previous tasks
- JSON-structured responses
- Chat memory, tools and internet access for Chat Agent and Custom Prompt
Memory and tools attach to the AI task on their own ports. They are reference nodes: they never run as a step in the flow, they are things the AI task reaches for while it runs:
flowchart TD
A[Prompt and input data] --> B[AI Prompt]
C[(Memory store)] -.->|memory port| B
D[Tool tasks] -.->|tool port| B
B --> E[Generated output]
Input and Prompt¶
Every AI Prompt task has two parts, and they do different jobs:
- Input is what the AI works on — the email, the message, the transcript, the form answers. It is
required on every analysis type; with no Input the task fails. Usually it is a variable from an earlier
task, such as
{{task_<ID>_body}}from an email trigger or{{task_<ID>_message}}from a WhatsApp trigger. - Prompt is what you want done with it — your instructions. Only Custom Prompt and Chat Agent have one. The other analysis types write their own instructions, so a Prompt is not shown for them.
Keep the two apart: put the content in Input and the instructions in Prompt. Variables work in both.
What the AI is given, by analysis type¶
| Analysis type | Its instructions | What it does with the Input | output |
|---|---|---|---|
| Summary | Its own: summarise, within Max Words if set | Summarises it | Text |
| Sentiment | Its own: rate the sentiment | Rates it from 1 to 10 | A number from 1 to 10, or -1 when it cannot tell |
| Extract Data | Its own: pull out the Fields to Extract, nothing else | Finds each field in it | One value per field — see Extracted fields |
| Custom Prompt | Your Prompt | Follows your Prompt, with the Input as the message it is given | Text, or JSON with Output Format set to JSON |
| Chat Agent | Your Prompt, as the assistant's persona | Treats it as the person's latest message and replies to it | The reply, as text |
| Transcribe Recording | None | Input must be the address of a recording; it is transcribed (and translated to English with Translate to English) | The transcript |
With Custom Prompt and Chat Agent, anything connected to the memory and tools ports is added around the Input: the conversation so far from a Chat Thread, and what the tools return.
Examples¶
Custom Prompt — classify a lead
Input: {{task_<ID>_message}}
Prompt: Classify this enquiry as Hot, Warm or Cold.
Hot = mentions a budget or a timeline. Cold = a general question.
Answer with the one word only.
{{task_<ID>_output}} is then Hot, Warm or Cold — ready for an If or
Key Match task.
Extract Data — pull contact details out of an email
Chat Agent — a WhatsApp assistant
Input: {{task_<ID>_message}} the message that just arrived
Prompt: You are the booking assistant for Acme Dental. Be brief and friendly.
Never give medical advice — offer to book an appointment instead.
Connect a Chat Thread to its memory port so it remembers the conversation.
Extracted fields¶
Extract Data returns one value for each field you list, under a name made from the field's name:
lower case, with spaces turned into underscores and anything other than letters, numbers and spaces left
out. So Company Name becomes company_name, and E-mail becomes email. Read them as:
| Field to Extract | Use it as |
|---|---|
| Full Name | {{task_<ID>_output_full_name}} |
| Company Name | {{task_<ID>_output_company_name}} |
| Phone | {{task_<ID>_output_phone}} |
A field it cannot find is left empty. Each field also gets a confidence from 0 to 1, as
{{task_<ID>_output_confidence_company_name}}. One field per row — a field name cannot contain a comma.
A Custom Prompt with Output Format set to JSON works the same way: each key of the JSON it returns
is {{task_<ID>_output_<key>}}, and the whole answer is {{task_<ID>.JSON.output}}.
Images, files and attachments¶
The AI reads text only. It does not open an image, a PDF or any other file. Put an attachment's
address in the Input — for example the attachment_urls an Email Trigger
trigger gives — and the AI sees the address as text, not what the file shows. Internet access
reads web pages, not images or files, either.
So to work from a photo — a business card, a receipt — the picture has to become text before this task: for example a Webhook Out to a text-recognition service you use, with that service's answer as this task's Input. Transcribe Recording is the one exception: it takes the address of an audio or video recording.
Quick Start¶
Builder fields¶
The Field column is the label as it appears in the task builder; Key is the name the value is stored under and referenced by.
| Field | Key | Type | Default | Notes |
|---|---|---|---|---|
| Input | Input |
textarea | – | |
| AI model | ai_model |
select | gpt-5-mini-2025-08-07 |
Options: OpenAI · GPT-5 (Strong) · OpenAI · GPT-5 Mini (Balanced) · OpenAI · GPT-5 Nano (Fast) · Anthropic · Claude Opus 4.8 (Strong) · Anthropic · Claude Sonnet 5 (Balanced) · Google · Gemini Pro (Strong) · Google · Gemini Flash (Balanced) · Google · Gemini Flash Lite (Fast) |
| What type of analysis do you want to do? | analysisType |
select | summary |
Options: Summary · Sentiment · Extract Data · Custom Prompt · Chat Agent · Transcribe Recording |
| Max Words | Max Words |
number | – | Only shown when analysisType is summary |
| Fields to Extract | data_extraction_rows |
dyn-rows | – | Only shown when analysisType is data_extraction |
| Prompt | Prompt |
monospace | – | Only shown when analysisType is custom_prompt |
| System Prompt (assistant persona) | Prompt |
monospace | – | Only shown when analysisType is chat_agent |
| Output Format | outputFormat |
select | text |
Options: Text (default) · JSON. Only shown when analysisType is custom_prompt |
| Internet access | internet_access |
select | off |
Options: Off (default) · One website · Any website. Only shown when analysisType is custom_prompt, chat_agent |
| Translate to English | Translate |
select | false |
Options: No · Yes. Only shown when analysisType is transcription |
The builder's Input is the content the AI works on, and is required — see Input and Prompt.
- Add AI Prompt task
- Set Input to the content to work on, usually a variable from an earlier task
- Select AI model and the type of analysis
- For Custom Prompt or Chat Agent, write the Prompt
- Test with sample data
- Save
Simple Example:
Input: Email: {{task_49001_email}}
Company: {{task_49001_company}}
Message: {{task_49001_message}}
Prompt: Classify this lead as Hot, Warm, or Cold. Answer with the one word only.
The answer is in {{task_38001_output}} — 38001 standing for this AI Prompt task's own ID.
Chat Memory¶

The Chat Thread node is not a step in the chain. It hangs off the AI Prompt's memory port, so it is read when the AI task runs rather than executed in sequence. The tool port works the same way for tasks the AI can use while it works on its reply — see Tools. Everything on the main line runs in order; anything on a memory or tool port is used by the AI task.
For the conversational analysis types (Custom Prompt and Chat Agent), the AI task can remember a conversation across runs — the same pattern as chat assistants — by connecting a memory node, exactly like N8N. You don't set any fields on the AI task itself.
How to set it up:
- Add a Chat Thread node.
- On that node, set the Contact Number (e.g. a
{{sender_number}}chip from a WhatsApp/SMS trigger), the Message Type (SMS or WhatsApp), and optionally the Limit (how many recent messages to load). - Drag from the AI task's memory port — the small handle at the bottom-centre of the AI task node — down into that node's top input. It shows a dashed purple connection.
How it works — on each run, when a memory node is connected, the AI task:
- Loads the most recent messages of that contact's live WhatsApp/SMS thread and prepends them to your prompt as a
Conversation so far:transcript. Inbound messages become the user turns; outbound (agent or automation) become the assistant turns. - Runs the model with that history plus the new input.
Important behaviours:
- Settings live on the memory node, not the AI task (mirrors N8N). Connect it and you're done.
- Read-only. Chat Thread memory never writes turns back — the chat channel already persists every message. The AI's reply reaches the contact (and is stored) via a downstream send task.
- Purely additive. With nothing connected to the memory port, the task behaves exactly as before — no memory. Existing AI tasks are unaffected.
- First message just works. An empty thread simply omits the history block; it doesn't error.
- Only Chat Thread nodes may connect to the memory port, and only on the Custom Prompt and Chat Agent analysis types.
Tools¶
Connect tasks to the AI Prompt’s orange tools port, and the AI can use them while it works on its reply — looking things up, and changing things where you allow it, as often as it needs:
| Task | What the AI may do |
|---|---|
| Calendar | Check when people are busy; find a guest’s booking; book a meeting (when ticked) |
| Google Sheets | Read rows; find rows; add a row, change a row, add or change a row (when ticked) |
| Match Client | Find the client this conversation is about, with the details set on the task |
| Files | List the files of the client set on the task |
This works with Chat Agent and with Custom Prompt set to text output. The other analysis types — and Custom Prompt with JSON output, unless Internet access is on — get the tools’ results added to the prompt once, before the AI runs, and cannot change anything.
How it works. The AI reads the message, decides it needs something (“is 9 AM Tuesday free?”), asks the tool, reads the answer, and carries on — checking something else, booking, or replying. Each of these rounds is a step. Several lookups can happen in one step.
What you control:
- What the AI may do, on each attached task. Looking things up is on to begin with; anything that changes something is off until you tick it, and then happens at most 5 times per reply.
- The tool’s own settings set what it can reach: which spreadsheet, whose calendars, which client. The AI cannot go outside them.
- The prompt: when to use the tools, and whether to confirm with the person before changing anything.
Limits that always apply: a reply ends after 2 minutes for Chat Agent (5 minutes for Custom Prompt), and the AI then answers with what it has. A message that arrives while it works stops it before its next step, and nothing more is changed. If the task is retried after a failure, changes it already made are not made again.
Earlier in the conversation. With a Chat Thread connected, the AI is also told what its tools changed for this person in earlier replies — so “make it 10 instead” in a later message can find the meeting it booked.
Internet Access¶
Set Internet access on the task and the AI can read public web pages while it works — for example, "here is a company website, find their contact details", or "read this site and list what is wrong with it".
| Setting | What the AI can read |
|---|---|
| Off (default) | Nothing on the internet |
| One website | The website named in your prompt or input, and its own pages |
| Any website | That website, and any public site it links to |
Put the website address in the prompt or the input, usually as a variable. The AI opens the page, reads its text and its links, and decides which page to open next. For each page it gets the text, the headings, the contact details found on it (emails, phone numbers, addresses, social profiles) and basic checks such as the title, description and images with no alt text. It can also read a site's sitemap to find pages.
This works with Chat Agent and Custom Prompt, with text or JSON output.
Limits that always apply:
- At most 20 pages per run (6 for a Chat Agent), within the same time limits as other tools.
- Web pages only. It cannot log in, fill in forms, read PDFs or other files, or read pages that only appear after the site loads in a browser. Some sites block automated reading.
- It cannot make up an address. It opens only addresses in your prompt, input or conversation, and links found on pages it has read.
- Public websites only, and an hourly limit per account.
The pages it opened are listed in the task's tool_calls output.
Web pages can try to instruct the AI
A page can contain text written to mislead an AI. The limits above keep that from doing harm, but prefer One website when the same task also has tools that read client data or change things.
Configuring the AI Task¶

Model Selection¶
Pick the model under AI model — OpenAI (GPT-5, GPT-5 Mini, GPT-5 Nano), Anthropic (Claude Opus, Claude Sonnet) or
Google (Gemini Pro, Flash, Flash Lite). The label says which are Strong, Balanced or Fast: strong models
handle nuance and long instructions best and cost the most; fast ones suit simple classification. The model that ran
is in the ai_model output.
Writing Effective Prompts¶
Structure:
- Context - What information does AI need?
- Task - What should AI do?
- Format - How should AI respond?
- Constraints - Any rules or limitations?
Example:
Context: You are a sales assistant analyzing leads.
Task: Classify this lead based on the information provided:
- Name: {{task_49001_name}}
- Email: {{task_49001_email}}
- Company: {{task_49001_company}}
- Message: {{task_49001_message}}
Format: Respond with only: Hot, Warm, or Cold
Constraints:
- Hot = Has company email + mentions budget/timeline
- Warm = Has company email or shows clear interest
- Cold = Generic inquiry or personal email
Using Dynamic Context¶
Include data from previous tasks:
Analyze this customer support ticket:
Subject: {{task_46001_subject}}
From: {{task_46001_email}}
Message: {{task_46001_body}}
Customer history:
- Total orders: {{task_43001_order_count}}
- LTV: ${{task_43001_lifetime_value}}
- Last contact: {{task_43001_last_contact_date}}
Determine the urgency (High/Medium/Low) and suggest a response category (Refund/Support/Sales).
Response Format Options¶
The result is always in output: {{task_<ID>_output}}.
- Text — the default.
- JSON — with Custom Prompt, set Output Format to JSON and describe the structure in the prompt; the JSON
comes back in
output. - Extract Data — list the fields to pull out under Fields to Extract, one name per row; each comes back as its own value — see Extracted fields.
- Summary takes an optional Max Words.
There is no temperature or token-limit setting; length and tone are set by what the prompt asks for.
Credit is account-wide and shared. The same balance pays for AI usage, calls and SMS — running it down with one stops the others. It lives in Settings → Billing → Credits.
Two things worth knowing before you rely on it:
- The balance is not live. AI usage deductions are applied every 6 hours, so a burst of activity will not show up immediately and the figure on screen can lag real consumption.
- Low-credit warnings are opt-in per user. The threshold is set here, but who receives the email
is configured under each user's own settings. Setting the threshold to
0disables warnings entirely — including for everyone else.
The transaction list is where the shared balance becomes obvious: AI usage, calls and SMS all appear in one ledger, drawing down the same credit.
Auto top-up is off by default. With it off and the balance exhausted, AI tasks stop rather than queue.
Outputs¶
| Field | Type | Example | Notes |
|---|---|---|---|
output |
string | Hot |
The generated result. The field you use downstream. A number for Sentiment; one value per field for Extract Data and JSON output — see Extracted fields. |
ai_model |
string | gpt-5-mini-2025-08-07 |
Which model ran, after any default was applied. |
tokens_input |
number | 812 |
Tokens in the prompt. |
tokens_output |
number | 140 |
Tokens generated. |
tokens_total |
number | 952 |
Total tokens. |
billing_units |
number | 952 |
What the run was billed for. |
error |
string | … |
Set when the model call failed. |
outcome |
string | done |
With tools: done, needs_input (it asked the person something) or could_not_finish. |
outcome_summary |
string | Booked Jane for Tue 9 AM. |
With tools: what it did, in a sentence. |
steps_used |
number | 3 |
With tools: how many steps the reply took. |
tool_calls |
list | […] |
With tools: each call — tool, what it was asked, and what came back. |
run |
boolean | true |
|
run_text |
string | Successfully made prompt. |
A Chat Agent replies only to the latest message
If another message arrived in the chat while the run was waiting, a Chat Agent does not answer the older one: it completes with Not the latest chat message from user — no children tasks were run. and the tasks beneath it do not run. The newer message's own run replies instead. A failure, by contrast, fails the task.
This task consumes AI credits
billing_units records what was charged. If the account has insufficient credit the task fails
before calling the model.
Real-World Examples¶
Classify an inbound email and route it¶
Email Trigger
└─ AI Prompt "Classify this as Sales, Support or Billing"
└─ Key Match Sales → sales@…, Support → support@…
└─ Email forward it on
Draft a reply with the conversation as context¶
WhatsApp Message Received
└─ AI Prompt Chat Agent — Input: the message that arrived
┆ memory port ┄┄ Chat Thread that contact's WhatsApp history (not a step in the chain)
└─ WhatsApp Business send {{task_<ID>_output}}
The Chat Thread hangs off the AI task's memory port — see Chat Memory — rather than running as a step before it.
Summarise a call¶
Call Tracking Trigger
└─ Speech to Text transcribe {{task_51001_recording_url}}
└─ AI Prompt "Summarise this call and list any commitments"
└─ Workflow Note log the summary
Advanced Techniques¶
Chain of Thought Prompting¶
For complex reasoning:
Prompt:
Think step-by-step to analyze this deal:
Deal Info: [data]
Step 1: List all positive signals
Step 2: List all red flags
Step 3: Compare to typical winning deals
Step 4: Provide final recommendation with confidence score
Few-Shot Learning¶
Provide examples in prompt:
Classify these leads:
Examples:
Input: "CEO of Acme Corp, interested in enterprise plan, budget approved"
Output: Hot
Input: "Student asking about features"
Output: Cold
Now classify:
Input: {{task_49001_message}}
Output:
Response Validation¶
Use Code task after AI:
const response = input.task_38001_output;
const validCategories = ['Hot', 'Warm', 'Cold'];
if (!validCategories.includes(response)) {
return {
validated: false,
category: 'Cold', // Default fallback
};
}
return { validated: true, category: response };
Best Practices¶
Prompt Engineering¶
- Be specific - Clear instructions yield better results
- Provide context - More context = more accurate
- Define format - Specify exact output structure
- Include constraints - Set boundaries and rules
- Test variations - Iterate to find best prompt
Cost Management¶
- Choose the right model - a Fast model for simple classification, a Strong one for complex work
- Keep prompts and context short - you pay for every token in and out
- Ask for short answers - a word or a line where that is all you need
- Don't re-ask - store a result with a Variable task if later tasks need it again
Reliability¶
- Always validate - Check AI response format
- Provide defaults - Fallback values if AI fails
- Handle errors - Use If task to check success
- Don't trust 100% - Human review for critical decisions
- Log responses - Track for quality monitoring
Security¶
- Sanitize inputs - Clean user data before AI
- Don't expose sensitive data - Mask PII when possible
- Validate outputs - Check for injection attempts
- Rate limit - Prevent abuse
- Monitor costs - Set alerts for unusual usage
Troubleshooting¶
Empty or Invalid Response¶
Check:
- Prompt clear and specific?
- Input data contains expected fields?
- Model appropriate for task complexity?
- Token limit sufficient?
Debug: Open the run in the workflow's Records and read the task's output
Inconsistent Classifications¶
Cause: an ambiguous prompt
Solution:
- Add explicit classification rules
- Ask for one word from a fixed list
- Provide examples in prompt
Response Not in Expected Format¶
Issue: Asked for JSON, got plain text
Solution:
Prompt: You MUST respond with valid JSON only.
Do not include any text before or after the JSON.
{
"field": "value"
}
Alternative: Use Code task to parse and clean response
Timeout or Slow Response¶
Causes:
- A Strong model on a simple job
- Very long prompts
Solutions:
- Switch to a Fast model for simple tasks
- Reduce input context length
Costs Higher Than Expected¶
Check:
- Using a Strong model where a Fast one would do?
- Running in high-frequency loops?
- Long prompts or long context?
Optimize:
- Use a Fast model for classification/extraction
- Ask for short answers
- Simplify prompts
Frequently Asked Questions¶
What models are available?¶
The ones under AI model on the task: OpenAI GPT-5 (Strong, Mini, Nano), Anthropic Claude (Opus, Sonnet) and Google Gemini (Pro, Flash, Flash Lite).
How much does each run cost?¶
Each run is billed from the account's credit by the tokens it used — billing_units records it, and the Credits
transactions list shows it as AI Usage.
Can AI access external data?¶
Only what you give it: data you include in the prompt from previous workflow tasks, the tasks on its tools port, and — when you switch on Internet access — public web pages.
How accurate is the AI?¶
Depends on:
- Task complexity
- Prompt quality
- Model selection
- Input data quality
Always validate critical outputs.
Can AI generate images?¶
No — this task returns text (or JSON). Transcribe Recording turns audio into text.
Can AI read an image or an attachment?¶
No — it reads text only. An image's or a file's address in the Input is read as text, not opened. See Images, files and attachments.
How do I structure JSON responses?¶
Explicitly define schema in prompt:
Related Tasks¶
- Code - Process AI responses
- If Statement - Route based on AI classification
- Variable - Cache AI results
- Formatter - Clean AI output
- Email - Send AI-generated content