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";23const result = await relay4 .workflow("content-pipeline")56 // Step 1: Research topic and gather data7 .step("research")8 .with("perplexity:sonar-pro")9 .prompt(`Research this topic comprehensively:1011Topic: {{topic}}12Target Audience: {{audience}}1314Gather:15- Latest statistics and data (with sources)16- Expert quotes and perspectives17- Common questions and pain points18- Competitor content gaps19- Trending subtopics2021Provide detailed research report with citations.`)2223 // Step 2: Create content outline24 .step("outline")25 .with("anthropic:claude-3.5-sonnet")26 .depends("research")27 .prompt(`Create a comprehensive article outline:2829Research: {{research.output}}3031Topic: {{topic}}32Target Length: {{targetWords}} words33Content Type: {{contentType}}3435Requirements:36- Hook readers in intro37- Logical flow between sections38- Include data points and examples39- SEO-optimized headings (H2/H3)40- Conclusion with CTA4142Return structured outline with section descriptions.`)4344 // Step 3: Write first draft45 .step("draft")46 .with("anthropic:claude-3.5-sonnet")47 .depends("research", "outline")48 .prompt(`Write a complete article following this outline:4950{{outline.output}}5152Research Data: {{research.output}}5354Style Guide:55- Active voice, conversational tone56- Short paragraphs (3-4 sentences max)57- Include specific examples58- Use transition phrases59- Target reading level: {{readingLevel}}6061Write {{targetWords}} words.`)6263 // Step 4: Edit and refine64 .step("edit")65 .with("openai:gpt-4o")66 .depends("draft")67 .prompt(`Edit this article for clarity and impact:6869{{draft.output}}7071Improve:72- Sentence structure and flow73- Remove jargon or explain it74- Strengthen weak sections75- Add compelling examples76- Ensure consistent tone77- Fix any factual errors7879Maintain the author's voice.`)8081 // Step 5: SEO optimization82 .step("seo-optimize")83 .with("openai:gpt-4o")84 .depends("edit")85 .prompt(`Optimize this content for SEO:8687Article: {{edit.output}}88Primary Keyword: {{primaryKeyword}}89Secondary Keywords: {{secondaryKeywords}}9091Generate:92- Meta title (50-60 chars)93- Meta description (150-160 chars)94- Suggested slug95- Internal linking opportunities (mention 3-5 relevant topics)96- Image alt text suggestions97- FAQ schema opportunities9899Return as structured JSON.`)100101 // Step 6: Generate social posts102 .step("social-content")103 .with("anthropic:claude-3.5-sonnet")104 .depends("edit", "seo-optimize")105 .prompt(`Create social media posts for this article:106107{{edit.output}}108109SEO Data: {{seo-optimize.output}}110111Generate posts for:1121. Twitter/X (280 chars, thread of 3 tweets)1132. LinkedIn (1300 chars, professional tone)1143. Facebook (300 chars, casual tone)115116Each should:117- Hook attention immediately118- Highlight key insight119- Include CTA to read article120- Use relevant hashtags`)121122 .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 });131132// Publish to CMS133await 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 publishing139});140141console.log("Social Posts:", result.steps["social-content"].output);Scheduled Content Calendar
1// Run weekly for content calendar2const topics = [3 "10 AI Use Cases for Enterprise IT",4 "Choosing the Right LLM for Your Workflow",5 "Cost Optimization for AI Applications",6];78for (const topic of topics) {9 await relay10 .workflow("content-pipeline")11 .run({12 topic,13 audience: "Enterprise decision makers",14 targetWords: 2000,15 contentType: "Thought leadership",16 });1718 await delay(60000); // Rate limit: 1 article per minute19}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