Content Production Pipeline

Automate content creation from research to published article with multi-model collaboration.

This workflow orchestrates research, outlining, writing, editing, and SEO optimization across multiple AI models.

Implementation

1import { relay } from "@relayplane/workflows";
2
3const result = await relay
4 .workflow("content-pipeline")
5
6 // Step 1: Research topic and gather data
7 .step("research")
8 .with("perplexity:sonar-pro")
9 .prompt(`Research this topic comprehensively:
10
11Topic: {{topic}}
12Target Audience: {{audience}}
13
14Gather:
15- Latest statistics and data (with sources)
16- Expert quotes and perspectives
17- Common questions and pain points
18- Competitor content gaps
19- Trending subtopics
20
21Provide detailed research report with citations.`)
22
23 // Step 2: Create content outline
24 .step("outline")
25 .with("anthropic:claude-3.5-sonnet")
26 .depends("research")
27 .prompt(`Create a comprehensive article outline:
28
29Research: {{research.output}}
30
31Topic: {{topic}}
32Target Length: {{targetWords}} words
33Content Type: {{contentType}}
34
35Requirements:
36- Hook readers in intro
37- Logical flow between sections
38- Include data points and examples
39- SEO-optimized headings (H2/H3)
40- Conclusion with CTA
41
42Return structured outline with section descriptions.`)
43
44 // Step 3: Write first draft
45 .step("draft")
46 .with("anthropic:claude-3.5-sonnet")
47 .depends("research", "outline")
48 .prompt(`Write a complete article following this outline:
49
50{{outline.output}}
51
52Research Data: {{research.output}}
53
54Style Guide:
55- Active voice, conversational tone
56- Short paragraphs (3-4 sentences max)
57- Include specific examples
58- Use transition phrases
59- Target reading level: {{readingLevel}}
60
61Write {{targetWords}} words.`)
62
63 // Step 4: Edit and refine
64 .step("edit")
65 .with("openai:gpt-4o")
66 .depends("draft")
67 .prompt(`Edit this article for clarity and impact:
68
69{{draft.output}}
70
71Improve:
72- Sentence structure and flow
73- Remove jargon or explain it
74- Strengthen weak sections
75- Add compelling examples
76- Ensure consistent tone
77- Fix any factual errors
78
79Maintain the author's voice.`)
80
81 // Step 5: SEO optimization
82 .step("seo-optimize")
83 .with("openai:gpt-4o")
84 .depends("edit")
85 .prompt(`Optimize this content for SEO:
86
87Article: {{edit.output}}
88Primary Keyword: {{primaryKeyword}}
89Secondary Keywords: {{secondaryKeywords}}
90
91Generate:
92- Meta title (50-60 chars)
93- Meta description (150-160 chars)
94- Suggested slug
95- Internal linking opportunities (mention 3-5 relevant topics)
96- Image alt text suggestions
97- FAQ schema opportunities
98
99Return as structured JSON.`)
100
101 // Step 6: Generate social posts
102 .step("social-content")
103 .with("anthropic:claude-3.5-sonnet")
104 .depends("edit", "seo-optimize")
105 .prompt(`Create social media posts for this article:
106
107{{edit.output}}
108
109SEO Data: {{seo-optimize.output}}
110
111Generate posts for:
1121. Twitter/X (280 chars, thread of 3 tweets)
1132. LinkedIn (1300 chars, professional tone)
1143. Facebook (300 chars, casual tone)
115
116Each should:
117- Hook attention immediately
118- Highlight key insight
119- Include CTA to read article
120- Use relevant hashtags`)
121
122 .run({
123 topic: "AI-powered workflow automation for enterprises",
124 audience: "Engineering leaders and DevOps teams",
125 targetWords: 1500,
126 contentType: "How-to guide",
127 readingLevel: "College level",
128 primaryKeyword: "AI workflow automation",
129 secondaryKeywords: ["enterprise automation", "AI agents", "workflow orchestration"],
130 });
131
132// Publish to CMS
133await publishToCMS({
134 title: JSON.parse(result.steps["seo-optimize"].output).metaTitle,
135 slug: JSON.parse(result.steps["seo-optimize"].output).slug,
136 content: result.steps["edit"].output,
137 metaDescription: JSON.parse(result.steps["seo-optimize"].output).metaDescription,
138 status: "draft", // For human review before publishing
139});
140
141console.log("Social Posts:", result.steps["social-content"].output);

Scheduled Content Calendar

1// Run weekly for content calendar
2const topics = [
3 "10 AI Use Cases for Enterprise IT",
4 "Choosing the Right LLM for Your Workflow",
5 "Cost Optimization for AI Applications",
6];
7
8for (const topic of topics) {
9 await relay
10 .workflow("content-pipeline")
11 .run({
12 topic,
13 audience: "Enterprise decision makers",
14 targetWords: 2000,
15 contentType: "Thought leadership",
16 });
17
18 await delay(60000); // Rate limit: 1 article per minute
19}

Quality Metrics

  • Speed: Full article in 3-5 minutes vs 4-6 hours manual
  • Consistency: Brand voice maintained across all content
  • SEO: Auto-optimized for search rankings
  • Distribution: Social content generated simultaneously
Human Review Required: Always have editors review before publishing. This workflow creates high-quality drafts, not final copy.

Customization Ideas

  • Add image generation step (DALL-E/Midjourney)
  • Include competitor analysis step
  • Generate email newsletter version
  • Create video script variation
  • Auto-translate for international markets