Automations
Run AI Agent Node
5 min readnode-ai-agent
Call a language model with a system and user prompt, storing the response in a variable for downstream use.
Run AI Agent Node
Sends a prompt to a language model (GPT-4o, Claude, or Gemini) and stores the response text in {{variables.aiResult}} (or a custom variable name). Use it to generate personalised copy, score leads, classify enquiries, or draft replies.
When to use it
- Generate a personalised email draft based on a lead's enquiry.
- Score a lead from 1–100 based on their form responses and store the score for routing.
---
Required fields
| Field | Type | Required | Description |
|---|---|---|---|
| model | enum | Yes | gpt-4o, claude-3-5-sonnet, or gemini-1.5-pro |
| systemPrompt | string | Yes | Instructions for the model's role and behaviour |
| userPrompt | string | Yes | The actual request — {{variables}} and {{lead.xxx}} supported |
---
Optional fields
| Field | Type | Required | Description |
|---|---|---|---|
| outputVar | string | No | Variable name to store the response (default: aiResult) |
---
Variables available
| Variable | Description |
|---|---|
{{variables.aiResult}} | The model's text response (or custom name if set) |
---
Step-by-step setup
- Add a Run AI Agent node to the canvas.
- Select the model — GPT-4o is fastest; Claude is best for nuanced writing.
- Write a clear system prompt e.g.
You are a lead qualification specialist. Return only a JSON object with a "score" (0-100) and "reason" (string). - Write the user prompt referencing lead data:
Lead details: Name: {{lead.firstName}}, Enquiry: {{variables.formResponse}}. - Optionally rename the output variable e.g.
qualificationResult. - Use
{{variables.qualificationResult}}in downstream nodes.
---
Example config
json
{
"model": "gpt-4o",
"systemPrompt": "You are a sales qualification assistant. Respond only with a JSON object: {"score": number, "reason": string}.",
"userPrompt": "Lead name: {{lead.firstName}} {{lead.lastName}}\nEnquiry: {{variables.formText}}",
"outputVar": "qualification"
}
---
Tips & gotchas
- Be explicit in the system prompt about the output format — if you want JSON, say so and add "Return only valid JSON, no commentary."
- Pair this node with AI Extract if you want to reliably pull structured fields out of free-form text.
- API keys for each model provider must be set in your workspace settings or environment (
OPENAI_API_KEY,ANTHROPIC_API_KEY,GOOGLE_AI_API_KEY). - The response is stored as a string. If the model returns JSON, parse it downstream with AI Extract or reference specific keys using dot notation.