Agent Node
The Agent node leverages AI language models to generate text, analyze content, answer questions, and transform data using natural language processing.
Overview
Agent nodes provide access to multiple AI models including:
- GPT-4 - Advanced reasoning and complex tasks
- GPT-3.5 - Fast, efficient for standard tasks
- Claude - Anthropic's AI assistant
- Local Models - Self-hosted LLMs
Configuration
Model Selection
Choose the appropriate model for your use case:
| Model | Best For | Speed | Cost |
|---|---|---|---|
| GPT-4 | Complex reasoning, analysis | Slower | Higher |
| GPT-3.5 | General tasks, summaries | Fast | Lower |
| Claude | Long context, coding | Medium | Medium |
| Local | Privacy, offline use | Varies | Free |
Core Parameters
Prompt
The instruction or question for the AI model:
Analyze the customer feedback and identify:
1. Main concerns
2. Satisfaction level (1-10)
3. Suggested improvements
Data: {{input}}
System Message (Optional)
Sets the AI's role and behavior:
You are a customer service expert. Be concise,
professional, and focus on actionable insights.
Temperature (0-2)
Controls creativity vs consistency:
- 0: Deterministic, same output each time
- 0.7: Balanced creativity (default)
- 1.5: Creative, varied responses
- 2: Maximum creativity, may be unpredictable
Max Tokens
Maximum response length (1 token ≈ 4 characters):
- Short responses: 50-200
- Standard: 500-1000
- Long form: 2000-4000
Input Data
Agent nodes receive data from previous nodes through {{input}}:
Direct Reference
Summarize this article: {{input.article}}
Customer name: {{input.customer.name}}
JSON Processing
Process this order data:
{{input}}
Extract key information and format as a shipping label.
Prompt Engineering
Effective Prompts
Be Specific
❌ "Process this data"
✅ "Extract customer names, emails, and purchase amounts
from the JSON data. Format as a CSV with headers."
Provide Structure
Analyze the sales data and provide:
## Summary
[2-3 sentences overview]
## Key Metrics
- Total revenue:
- Number of transactions:
- Average order value:
## Recommendations
1. [First recommendation]
2. [Second recommendation]
Include Examples
Convert product descriptions to marketing copy.
Example:
Input: "Blue cotton t-shirt, machine washable"
Output: "Premium comfort meets easy care in our classic blue cotton tee"
Now convert: {{input.description}}
Common Use Cases
Data Extraction
Extract the following from the email:
- Sender name
- Main request
- Urgency level (low/medium/high)
- Required action
Email content: {{input.emailBody}}
Content Generation
Write a professional response to this customer complaint:
{{input.complaint}}
Tone: Empathetic and solution-focused
Include: Apology, explanation, resolution offer
Length: 100-150 words
Analysis & Classification
Classify this support ticket:
Category: [Technical/Billing/Feature Request/Other]
Priority: [P1-Critical/P2-High/P3-Medium/P4-Low]
Sentiment: [Positive/Neutral/Negative]
Estimated Resolution Time: [hours]
Ticket: {{input.ticket}}
Translation & Transformation
Convert this technical documentation to user-friendly FAQ:
Technical: {{input.documentation}}
Format:
Q: [Question in simple terms]
A: [Clear, concise answer without jargon]
Advanced Techniques
Chain of Thought
Solve this step by step:
1. First, identify the problem type
2. List relevant information
3. Apply appropriate method
4. Verify the solution
5. Provide final answer
Problem: {{input.problem}}
Few-Shot Learning
Learn from these examples then process the new item:
Example 1:
Input: {sku: "ABC123", qty: 5}
Output: "Stock Check Required: ABC123 (5 units)"
Example 2:
Input: {sku: "XYZ789", qty: 0}
Output: "Out of Stock Alert: XYZ789"
New item: {{input}}
Role-Based Responses
System: You are a senior data analyst with 10 years experience.
Prompt: Review this quarterly report and provide executive insights:
{{input.report}}
Focus on: Trends, risks, opportunities, action items
Output Handling
Structured Output
Request specific formats:
Return your analysis as JSON:
{
"summary": "...",
"score": 0-100,
"recommendations": ["...", "..."],
"nextSteps": "..."
}
Parsing Responses
The Agent node output can be used in downstream nodes:
// In a Code node after Agent
const analysis = JSON.parse(input);
const score = analysis.score;
const urgent = score < 50;Model-Specific Features
GPT-4 Vision
Analyze images (when available):
Describe the contents of this image.
Identify any text, objects, and overall scene.
Claude's Long Context
Process large documents:
Review this 50-page contract and highlight:
1. Key terms and conditions
2. Potential risks
3. Unusual clauses
Function Calling
Some models support function definitions:
{
"function": "search_database",
"description": "Search customer records",
"parameters": {
"query": "string",
"filters": "object"
}
}
Best Practices
1. Optimize Token Usage
- Be concise in prompts
- Request specific output lengths
- Remove unnecessary context
2. Handle Errors Gracefully
- Add fallback prompts
- Validate AI responses
- Include retry logic for failures
3. Maintain Consistency
- Use system messages for consistent behavior
- Keep temperature low for predictable outputs
- Create prompt templates for repeated tasks
4. Security Considerations
- Never include sensitive data in prompts
- Validate and sanitize AI outputs
- Be cautious with executable code generation
Troubleshooting
"Model timeout"
- Reduce max tokens
- Simplify prompt
- Break into smaller tasks
"Inconsistent outputs"
- Lower temperature setting
- Add more specific instructions
- Include output examples
"Exceeds token limit"
- Shorten input data
- Summarize before processing
- Use a model with larger context
"Poor quality responses"
- Improve prompt clarity
- Add examples
- Try different model
- Adjust temperature
Cost Optimization
Strategies
- Use appropriate models - GPT-3.5 for simple tasks
- Cache responses - Reuse for identical inputs
- Batch processing - Combine multiple requests
- Prompt optimization - Shorter prompts = lower cost
- Local models - For high-volume, non-critical tasks
Examples
Customer Service Bot
System: You are a helpful customer service representative.
Prompt: Respond to this customer inquiry:
{{input.inquiry}}
Guidelines:
- Be friendly and professional
- Provide specific solutions
- Include relevant links/resources
- Keep response under 150 words
Content Moderator
Analyze this user comment for:
1. Inappropriate content (yes/no)
2. Sentiment (positive/neutral/negative)
3. Action required (approve/flag/reject)
Comment: {{input.comment}}
Return as: {"appropriate": boolean, "sentiment": string, "action": string}
Data Transformer
Convert this unstructured text into structured data:
Text: {{input.text}}
Extract:
- Names (people and companies)
- Dates and times
- Monetary amounts
- Locations
- Key actions/events
Format as JSON with appropriate keys.
Integration Tips
With Code Nodes
// Process Agent output
const aiResponse = input;
const structured = aiResponse.split('\n').map(line => ({
item: line.trim(),
processed: true
}));
return structured;With Condition Nodes
Use Agent for intelligent routing:
Classify urgency as HIGH, MEDIUM, or LOW:
{{input.message}}
Then branch based on the classification.
With Loop Nodes
Process arrays item by item:
Summarize this review in one sentence:
{{input.currentItem.review}}
Related Topics
- Code Node - Process Agent outputs
- Agents Overview - How agents fit into workflows
- Local AI Models - Run models on your own hardware
- Usage Metering - Track AI usage