Skip to content

AI Prompt Task

Overview

The AI Prompt Task uses artificial intelligence to generate content, analyze text, extract information, classify data, or answer questions. Powered by OpenAI's GPT models, 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:

  • GPT-4 and GPT-3.5 Turbo models
  • Custom prompt templates
  • Context from previous tasks
  • JSON-structured responses
  • Temperature control for creativity
  • Token limit management
  • Cost-effective operation
  • Reliable error handling

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]

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
Translate to English Translate select false Options: No · Yes. Only shown when analysisType is transcription
  1. Add AI Prompt task
  2. Select AI model
  3. Write prompt with context
  4. Configure response format
  5. Test with sample data
  6. Save

Simple Example:

Prompt: Classify this lead as Hot, Warm, or Cold based on:
- Email: {{task_49001_email}}
- Message: {{task_49001_message}}
- Company: {{task_49001_company}}

Output: {{task_38001_response}}

Chat Memory

A WhatsApp chat assistant on the BaseCloud canvas. A WhatsApp Message Received trigger connects to an AI Prompt task, which connects on to a WhatsApp Business task. The AI Prompt node has two extra ports beneath it labelled memory and tool; a dashed line runs from the memory port down to a separate Chat Thread node, which sits off the main chain rather than in it

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:

  1. Add a Chat Thread node.
  2. 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).
  3. 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:

  1. 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.
  2. 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 — 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.

Configuring the AI Task

The AI Prompt task configuration panel. An Input field accepts a value or a dragged chip, the AI Model is set to OpenAI GPT-5 Mini (Balanced), and the analysis type is set to Chat Agent. A note explains that Chat Agent turns the task into a conversational assistant whose persona comes from the prompt below, and that connecting a Chat Thread node to the memory port lets it remember the conversation. Below is a System Prompt editor holding the assistant's instructions

The lower half of the AI Prompt panel. Beneath the System Prompt editor, two notes explain the extra ports: chat memory, where a Chat Thread node connected to the memory port loads live WhatsApp and Text history read-only and, with nothing connected, the task runs as a one-shot prompt with no memory; and tools, where read-only tasks such as Match Client, Files or Google Sheets Get Rows connect to the orange tools port and have their output added to the prompt as reference data, with write actions on a linked Sheets task ignored

Model Selection

GPT-4 Turbo (Recommended for complex tasks)

  • More accurate and nuanced
  • Better reasoning
  • Handles complex instructions
  • Higher cost per token

GPT-3.5 Turbo (Recommended for simple tasks)

  • Fast responses
  • Cost-effective
  • Good for straightforward tasks
  • Lower cost per token

Selection Guide:

  • Use GPT-4 for: Analysis, complex extraction, nuanced writing
  • Use GPT-3.5 for: Classification, simple generation, formatting

Writing Effective Prompts

Structure:

  1. Context - What information does AI need?
  2. Task - What should AI do?
  3. Format - How should AI respond?
  4. 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

Plain Text:

Output: {{task_38001_response}}

JSON Structure:

Respond in JSON format:
{
  "category": "Support",
  "urgency": "High",
  "summary": "Brief description"
}

Access: {{task_38001_category}}, {{task_38001_urgency}}

List:

Provide 3 bullet points.

Access: {{task_38001_response}}

Temperature Setting

Controls creativity vs consistency:

Temperature Behavior Use For
0.0 - 0.3 Deterministic, consistent Classification, extraction, analysis
0.4 - 0.7 Balanced General content generation
0.8 - 1.0 Creative, varied Marketing copy, creative writing

Configuration:

Temperature: 0.2 (for consistent classification)
Temperature: 0.7 (for creative email content)

Token Limits

Max Tokens: Controls response length

  • Short responses: 100-200 tokens
  • Paragraphs: 300-500 tokens
  • Long content: 1000-2000 tokens

Note: ~4 characters = 1 token on average

The Credits tab of the Billing screen in BaseCloud Settings, alongside Invoices and Payment Methods tabs. A Credit Balance is shown as a large figure, with a line beneath reading "AI usage deductions are applied every 6 hours". An amber notice reads "Credit balance is low — your balance is at or below your warning threshold. Top up to keep AI features working", with a Top Up button. Below are a Top Up Amount field with a Buy Credit button, an Auto Top-Up section with an unchecked "Enable auto top-up" box and a Save Settings button, and a Low Credit Warning section explaining that an email is sent when the balance drops below a threshold, that recipients are configured per user, and that setting it to zero disables warnings

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 0 disables warnings entirely — including for everyone else.

The lower half of the Credits tab. A Low Credit Warning section sets a warning threshold in rand and explains that recipients are configured per user and that zero disables the emails. Below it a Transactions list, filtered by All, Credits or Debits, shows a running history: an AI Usage entry for AI transcript generation, two Call entries for a five-minute inbound call and a two-minute outbound call, and a Text entry for an SMS — each with a date and a deduction in rand. The phone numbers in the inbound call and SMS entries are blacked out

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 Positive The generated result. The field you use downstream.
ai_model string gpt-4o 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 AI prompt completed.

prevent_children stops the branch

On some failure paths the task sets prevent_children, which stops the tasks beneath it from running rather than letting them run with an empty result. A branch that silently does nothing after an AI task usually means this fired — check run_text.

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
  └─ Chat Thread          read the history
      └─ AI Prompt        draft a reply, memory key {{task_61001_session_id}}
          └─ WhatsApp Business   send 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_response;
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

  1. Be specific - Clear instructions yield better results
  2. Provide context - More context = more accurate
  3. Define format - Specify exact output structure
  4. Include constraints - Set boundaries and rules
  5. Test variations - Iterate to find best prompt

Cost Management

  1. Choose right model - GPT-3.5 for simple, GPT-4 for complex
  2. Limit tokens - Set max_tokens appropriately
  3. Reduce temperature for consistency - Fewer retries
  4. Cache common prompts - Use Variable task
  5. Batch similar requests - Process in loops

Reliability

  1. Always validate - Check AI response format
  2. Provide defaults - Fallback values if AI fails
  3. Handle errors - Use If task to check success
  4. Don't trust 100% - Human review for critical decisions
  5. Log responses - Track for quality monitoring

Security

  1. Sanitize inputs - Clean user data before AI
  2. Don't expose sensitive data - Mask PII when possible
  3. Validate outputs - Check for injection attempts
  4. Rate limit - Prevent abuse
  5. Monitor costs - Set alerts for unusual usage

Troubleshooting

Empty or Invalid Response

Check:

  1. Prompt clear and specific?
  2. Input data contains expected fields?
  3. Model appropriate for task complexity?
  4. Token limit sufficient?

Debug: View execution history → AI Prompt task → See full request/response

Inconsistent Classifications

Cause: Temperature too high or prompt ambiguous

Solution:

  • Lower temperature to 0.0-0.2
  • Add explicit classification rules
  • 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:

  • GPT-4 slower than GPT-3.5
  • Very long prompts
  • Max tokens set too high

Solutions:

  • Switch to GPT-3.5 for simple tasks
  • Reduce input context length
  • Lower max_tokens setting

Costs Higher Than Expected

Check:

  • Using GPT-4 when GPT-3.5 sufficient?
  • Token limits set too high?
  • Running in high-frequency loops?
  • Inefficient prompts?

Optimize:

  • Use GPT-3.5 for classification/extraction
  • Set appropriate max_tokens
  • Cache repeated AI calls
  • Simplify prompts

Frequently Asked Questions

What models are available?

  • GPT-4 Turbo - Most capable, best for complex tasks
  • GPT-3.5 Turbo - Fast and cost-effective

How much does each API call cost?

Pricing varies by model and token usage:

  • GPT-3.5: ~$0.002 per 1K tokens
  • GPT-4: ~$0.03 per 1K tokens

Check OpenAI pricing for current rates.

Can AI access external data?

No, AI only sees data you include in the prompt from previous workflow tasks.

How accurate is the AI?

Depends on:

  • Task complexity
  • Prompt quality
  • Model selection
  • Input data quality

Always validate critical outputs.

Can I use my own OpenAI API key?

Check with BaseCloud support for custom API key configuration.

Is there a rate limit?

Yes, reasonable rate limits apply. Contact support for high-volume needs.

Can AI generate images?

This task is text-only. Image generation requires separate DALL-E integration.

How do I structure JSON responses?

Explicitly define schema in prompt:

Respond with this exact JSON structure:
{
  "field1": "value",
  "field2": number
}

  • Code Task - Process AI responses
  • If Task - Route based on AI classification
  • Variable Task - Cache AI results
  • Formatter Task - Clean AI output
  • Email Task - Send AI-generated content