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
FieldTypeRequiredDescription
modelenumYesgpt-4o, claude-3-5-sonnet, or gemini-1.5-pro
systemPromptstringYesInstructions for the model's role and behaviour
userPromptstringYesThe actual request — {{variables}} and {{lead.xxx}} supported

---

Optional fields
FieldTypeRequiredDescription
outputVarstringNoVariable name to store the response (default: aiResult)

---

Variables available
VariableDescription
{{variables.aiResult}}The model's text response (or custom name if set)

---

Step-by-step setup
  1. Add a Run AI Agent node to the canvas.
  2. Select the model — GPT-4o is fastest; Claude is best for nuanced writing.
  3. 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).
  4. Write the user prompt referencing lead data: Lead details: Name: {{lead.firstName}}, Enquiry: {{variables.formResponse}}.
  5. Optionally rename the output variable e.g. qualificationResult.
  6. 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.