Search documentation

Search for pages in the documentation

AI Content Generation

Advanced patterns for generating content with AI agents

In this tutorial, you'll explore advanced AI patterns for generating various types of content, from follow-up emails to comprehensive research briefs. You'll learn to use both AI Prompt and AI Agent nodes effectively.

Time: 25 minutes Difficulty: Intermediate Prerequisites:

  • Completed previous tutorials
  • Understanding of AI Prompt nodes
  • Familiarity with Liquid templates

What You'll Learn

  • Crafting effective prompts for different content types
  • Using AI Agent with tools for research
  • Chaining multiple AI calls
  • Optimizing for quality and cost

Part 1: Follow-Up Email Generation

The Use Case

Automatically generate personalized follow-up emails after meetings.

Workflow Structure

text
[Meeting Ended] → [Load Meeting] → [AI: Generate Email] → [Email Send]

Step 1: Create the Workflow

  1. Create workflow: "AI Follow-Up Emails"
  2. Add Event Trigger: MEETING_ENDED
  3. Add Load Meeting node

Step 2: Configure AI Email Generation

Add AI Prompt node:

Model: Medium Return Type: String

System Message:

liquid
You are a professional business writer crafting follow-up emails after sales meetings.

Guidelines:
- Professional but warm tone
- Reference specific discussion points
- Include clear next steps
- Keep under 200 words
- No generic phrases like "It was great meeting you"

Structure:
1. Brief reference to the meeting topic
2. Key takeaways or decisions
3. Specific next steps with timeline
4. Clear call to action

User Message:

liquid
Write a follow-up email for this meeting:

Meeting: {{ json.meeting.title }}
Date: {{ json.meeting.startTime | date: "%B %d, %Y" }}
Duration: {{ json.meeting.durationMinutes }} minutes

Our Team: {% for a in json.meeting.attendees %}{% if a.internal %}{{ a.name }}{% unless forloop.last %}, {% endunless %}{% endif %}{% endfor %}

Their Team: {% for a in json.meeting.attendees %}{% unless a.internal %}{{ a.name }} ({{ a.title }}){% unless forloop.last %}, {% endunless %}{% endunless %}{% endfor %}

Summary:
{{ json.callRecording.transcriptSummary }}

Write the email body only (no subject line).

Step 3: Generate Subject Line

Add another AI Prompt for the subject:

Model: Low Return Type: String

User Message:

liquid
Generate a professional email subject line for this follow-up email.
Maximum 60 characters. No quotes around the subject.

Email content:
{{ steps.emailBody.value }}

Step 4: Send the Email

Add Email Send node:

To: Use recipient logic based on your needs Subject: {{ steps.subjectLine.value }} Body: {{ steps.emailBody.value }}

Part 2: Meeting Brief Generation

The Use Case

Generate comprehensive pre-meeting briefs using AI Agent with research tools.

Workflow Structure

text
[Meeting Starting] → [Load Meeting] → [AI Agent: Research] → [Slack Brief]

Step 1: Create the Workflow

  1. Create workflow: "Pre-Meeting Brief"
  2. Add Event Trigger: MEETING_START_MINUS_15M
  3. Add Load Meeting node

Step 2: Configure AI Agent

Add AI Agent node:

Model: High Return Type: String Tools: search, open, web_search

System Message:

liquid
You are a sales research assistant preparing meeting briefs.

You have access to:
- search: Search deal room documents
- open: Read specific documents
- web_search: Search the web

Create a comprehensive brief including:
1. Company Overview (from web search)
2. Recent News (from web search)
3. Deal Context (from deal room documents)
4. Talking Points (synthesized recommendations)

Be thorough but concise. Include only verified information.

User Message:

liquid
Prepare a meeting brief for:

Meeting: {{ json.meeting.title }}
Time: {{ json.meeting.startTime | date: "%B %d at %I:%M %p" }}

External Attendees:
{% for a in json.meeting.attendees %}{% unless a.internal %}
- {{ a.name }} ({{ a.title }}) - {{ a.company }}
{% endunless %}{% endfor %}

Research the company and attendees. Search the deal room for relevant context.
Create a brief I can review in 2 minutes.

Step 3: Format and Send

Add Slack Post:

Message:

liquid
📋 *Pre-Meeting Brief*
*{{ json.meeting.title }}*
Starting in 15 minutes

{{ json.value }}

_Research compiled by AI Agent_

Part 3: Multi-Stage Content Pipeline

The Use Case

Generate multiple content pieces from a single meeting, optimizing for both quality and cost.

Workflow Structure

text
[Meeting Ended] → [Load] → [Quick Summary] → [Detailed Analysis] → [Action Items] → [Compile & Send]

Step 1: Quick Summary (Low Cost)

First AI call for basic summary:

Model: Low Return Type: String

liquid
Summarize this meeting in 2-3 sentences:
{{ json.callRecording.transcriptSummary }}

Step 2: Detailed Analysis (Medium Cost)

Conditional detailed analysis only if needed:

Model: Medium Return Type: String

liquid
Provide detailed analysis of this meeting:

1. Key Discussion Points
2. Decisions Made
3. Open Questions
4. Risks or Concerns

Summary:
{{ json.callRecording.transcriptSummary }}

Step 3: Action Items (Structured Output)

Extract structured action items:

Model: Medium Return Type: String List

liquid
Extract action items as a list.
Format: "[Owner] - [Task] - [Due date if mentioned]"

{{ json.callRecording.transcriptSummary }}

Step 4: Compile Results

Use Liquid to combine all AI outputs:

liquid
# Meeting Report: {{ json.meeting.title }}

## Quick Summary
{{ steps.quickSummary.value }}

## Detailed Analysis
{{ steps.detailedAnalysis.value }}

## Action Items
{% for item in steps.actionItems.value %}
- {{ item }}
{% endfor %}

---
Generated: {{ "now" | date: "%B %d, %Y at %I:%M %p" }}

Part 4: Conditional AI Complexity

The Use Case

Use simpler AI for simple meetings, more powerful AI for complex ones.

Complexity Detection

First, detect meeting complexity:

Model: Low Return Type: Integer

liquid
Rate meeting complexity from 1-5:
1: Brief check-in, status update
2: Simple discussion, few topics
3: Standard business meeting
4: Complex discussion, multiple stakeholders
5: Strategic, high-stakes, technical depth

{{ json.callRecording.transcriptSummary }}

Route Based on Complexity

Use If node:

cel
json.value >= 4  // Complex meeting

High Complexity Path

Model: High

liquid
This is a complex meeting requiring detailed analysis...

Low Complexity Path

Model: Low

liquid
Provide a brief summary of this simple meeting...

Best Practices

1. Prompt Engineering Tips

Be Specific:

liquid
❌ "Summarize this meeting"
✅ "Summarize this sales meeting in 3 bullet points focusing on customer needs, objections, and next steps"

Provide Structure:

liquid
✅ Include explicit output format:
"Format your response as:
SUMMARY: [2-3 sentences]
DECISION: [key decision]
NEXT STEPS: [bullet list]"

Use Examples:

liquid
✅ Few-shot prompting:
"Example output:
SUMMARY: The team reviewed Q4 goals and decided to prioritize enterprise features.
DECISION: Launch enterprise tier in November.
NEXT STEPS:
- Sarah to finalize pricing
- Mike to update roadmap"

2. Model Selection

Content TypeRecommended ModelWhy
ClassificationLowSimple yes/no decisions
Basic summaryLowStraightforward extraction
Email draftsMediumGood balance of quality/cost
Detailed analysisMediumStandard reasoning
Research briefsHighComplex multi-source synthesis
Strategic recommendationsHighNuanced judgment needed

3. Token Optimization

Use Summaries:

liquid
✅ {{ json.callRecording.transcriptSummary }}  // ~500-1000 tokens
❌ {{ json.callRecording.transcript }}          // ~10,000-50,000 tokens

Include Only Needed Data:

liquid
✅ Meeting: {{ json.meeting.title }}
   Attendees: {{ json.meeting.attendees | map: "name" | join: ", " }}

❌ {{ json | json }}  // Full JSON dump

4. Error Handling

Always handle AI failures:

text
[AI Prompt]
    ├── Success → [Use output]
    └── Error → [Fallback message]

Fallback message:

liquid
Unable to generate AI summary. Please review the meeting manually:
{{ json.meeting.title }}

Advanced Pattern: Iterative Refinement

Step 1: Generate Draft

liquid
Generate a draft follow-up email...

Step 2: Review Draft

liquid
Review this email draft and identify:
1. Missing information
2. Unclear language
3. Suggested improvements

Draft:
{{ steps.draft.value }}

Step 3: Refine Based on Review

liquid
Improve this email based on the review feedback:

Original:
{{ steps.draft.value }}

Feedback:
{{ steps.review.value }}

Generate an improved version.

Troubleshooting

AI Output Too Long

Solution: Add explicit length constraints

liquid
Maximum 3 bullet points.
Each bullet under 20 words.

AI Missing Key Points

Solution: Be explicit about requirements

liquid
You MUST include:
- Customer's main concern
- Proposed solution
- Agreed next steps
If any of these weren't discussed, say "Not discussed"

AI Hallucinating Information

Solution: Add grounding instructions

liquid
Only include information explicitly stated in the transcript.
Do not infer or assume facts not mentioned.
If unsure, say "unclear from transcript"

Inconsistent Output Format

Solution: Use structured return types

liquid
Return Type: String List (instead of String)

Congratulations! 🎉

You've mastered advanced AI content generation! You now understand:

  • ✅ Crafting prompts for different content types
  • ✅ Using AI Agent with research tools
  • ✅ Multi-stage content pipelines
  • ✅ Cost optimization strategies
  • ✅ Error handling for AI nodes

Next Steps