← Back to CrewAI

Content Generation with CrewAI

Building collaborative content creation systems where specialized agents handle ideation, drafting, editing, and optimization to produce high-quality multi-format content.

Overview

Content teams include ideators who brainstorm topics, writers who draft content, editors who refine quality, and optimizers who tailor for different platforms. This division produces consistent, high-quality output at scale.

Content Crew Architecture

Multi-Format Content Pipeline

Python - Content Generation Crew
from crewai import Agent, Task, Crew
from crewai_tools import FileWriterTool, FileReadTool, BrowserTool
import json

# Define Content Agents
strategist = Agent(
    role="Content Strategist",
    goal="Research trends and brainstorm engaging topics",
    backstory="Marketing expert with 15 years content strategy experience",
    tools=[BrowserTool()],
    llm="gpt-4"
)

writer = Agent(
    role="Content Writer",
    goal="Write engaging, informative content in varied formats",
    backstory="Professional writer across blogs, technical docs, and marketing copy",
    tools=[FileWriterTool()],
    llm="gpt-4"
)

editor = Agent(
    role="Content Editor",
    goal="Enhance content quality, consistency, and brand voice",
    backstory="Editor with 10 years experience in content refinement",
    tools=[],
    llm="gpt-4"
)

social_manager = Agent(
    role="Social Media Manager",
    goal="Adapt content for different social platforms",
    backstory="Social media expert maximizing engagement",
    tools=[FileWriterTool()],
    llm="gpt-4"
)

# Define Tasks
strategy_task = Task(
    description="""Research current trends in {industry}.
    Brainstorm 5 compelling content ideas.
    Format as JSON with title, description, and target audience.""",
    agent=strategist,
    expected_output="JSON array of content ideas"
)

writing_task = Task(
    description="""Write a comprehensive {content_type} about {topic}.
    Target audience: {audience}
    Length: {length} words
    Include: introduction, key points, conclusion""",
    agent=writer,
    expected_output="Complete content piece"
)

editing_task = Task(
    description="""Edit and enhance the content for:
    - Grammar and clarity
    - Brand voice consistency
    - Engagement and readability
    - SEO optimization if applicable""",
    agent=editor,
    expected_output="Polished, publication-ready content"
)

social_task = Task(
    description="""Create platform-specific versions:
    - LinkedIn: Professional tone, 2-3 paragraphs
    - Twitter: Catchy, under 280 characters
    - Instagram: Engaging hooks with emojis
    - Email: Compelling subject line and preview text""",
    agent=social_manager,
    expected_output="JSON with platform-specific content variants"
)

# Create Content Crew
crew = Crew(
    agents=[strategist, writer, editor, social_manager],
    tasks=[strategy_task, writing_task, editing_task, social_task],
    verbose=True,
    process="sequential"
)

# Execute
inputs = {
    "industry": "Artificial Intelligence",
    "content_type": "Blog post",
    "topic": "Autonomous AI Agents in 2025",
    "audience": "Software developers",
    "length": 1500
}

result = crew.kickoff(inputs=inputs)

Blog Post Generation with SEO

Python - SEO-Optimized Blog Pipeline
from crewai import Agent, Task, Crew
from crewai_tools import ScrapeWebsiteTool

# SEO-focused agents
seo_researcher = Agent(
    role="SEO Researcher",
    goal="Research keywords and SEO best practices",
    backstory="SEO expert with proven track record",
    tools=[BrowserTool()],
    llm="gpt-4"
)

blog_writer = Agent(
    role="Blog Writer",
    goal="Write SEO-optimized, engaging blog posts",
    backstory="Content writer specializing in ranked articles",
    tools=[],
    llm="gpt-4"
)

metadata_agent = Agent(
    role="Metadata Specialist",
    goal="Create compelling titles, descriptions, and metadata",
    backstory="Conversion optimization expert",
    tools=[],
    llm="gpt-4"
)

# SEO Research Task
seo_task = Task(
    description="""Research SEO for: {blog_topic}
    Find:
    - Primary keyword and search volume
    - 10-15 LSI keywords
    - Competitor content analysis
    - Content structure recommendations""",
    agent=seo_researcher,
    expected_output="SEO research report with keywords and strategy"
)

# Blog Writing with SEO
blog_task = Task(
    description="""Write SEO-optimized blog post:
    - Title including primary keyword
    - 2000 word comprehensive guide
    - Include all LSI keywords naturally
    - H2/H3 headers with keywords
    - 2-3 relevant internal links
    - Call-to-action at end""",
    agent=blog_writer,
    expected_output="Complete blog post"
)

# Metadata Creation
metadata_task = Task(
    description="""Create SEO metadata:
    - Meta title (60 chars): Include primary keyword
    - Meta description (160 chars): Compelling preview
    - OG tags for social sharing
    - Schema.org markup for rich snippets""",
    agent=metadata_agent,
    expected_output="JSON with all metadata tags"
)

crew = Crew(
    agents=[seo_researcher, blog_writer, metadata_agent],
    tasks=[seo_task, blog_task, metadata_task],
    verbose=True
)

result = crew.kickoff(inputs={"blog_topic": "Machine Learning in Production"})

Video Script Generation

Python - Video Script Production
from crewai import Agent, Task, Crew
from pydantic import BaseModel

class VideoScript(BaseModel):
    scenes: list
    voiceover: str
    cta: str
    duration_minutes: float

# Video content agents
scriptwriter = Agent(
    role="Video Scriptwriter",
    goal="Create engaging video scripts with scene descriptions",
    backstory="Emmy-winning screenwriter and video producer",
    tools=[],
    llm="gpt-4"
)

voiceover_specialist = Agent(
    role="Voiceover Specialist",
    goal="Write professional voiceover copy",
    backstory="Voiceover artist with 10 years experience",
    tools=[],
    llm="gpt-4"
)

visual_director = Agent(
    role="Visual Director",
    goal="Create detailed scene and visual descriptions",
    backstory="Film director specializing in educational content",
    tools=[],
    llm="gpt-4"
)

# Script Task
script_task = Task(
    description="""Create video script for: {video_topic}
    - Duration: {video_length} minutes
    - Style: {style}
    - Include scene descriptions with visual direction
    - Note camera angles and transitions
    - Format as scene-by-scene breakdown""",
    agent=scriptwriter,
    expected_output="Detailed video script with scenes"
)

# Voiceover Task
voiceover_task = Task(
    description="""Write engaging voiceover for video script.
    - Professional, clear tone
    - Matches scene timing
    - Includes pacing notes
    - Create compelling opening hook
    - Strong call-to-action ending""",
    agent=voiceover_specialist,
    expected_output="Complete voiceover script with timing"
)

# Visual Direction Task
visual_task = Task(
    description="""Enhance with visual direction:
    - Detailed scene descriptions
    - Camera angles and movements
    - Lighting recommendations
    - Visual effects suggestions
    - Color palette recommendations""",
    agent=visual_director,
    expected_output="Visual direction guide"
)

crew = Crew(
    agents=[scriptwriter, voiceover_specialist, visual_director],
    tasks=[script_task, voiceover_task, visual_task],
    output_file="video_production_guide.md",
    verbose=True
)

inputs = {
    "video_topic": "Getting Started with AI Agents",
    "video_length": 5,
    "style": "Educational and engaging"
}

result = crew.kickoff(inputs=inputs)

Content Batch Processing

Python - Batch Content Generation
from crewai import Agent, Task, Crew
import asyncio
from typing import List

async def generate_content_batch(topics: List[str]) -> List[dict]:
    """Generate content for multiple topics in parallel"""
    
    writer = Agent(
        role="Content Writer",
        goal="Write engaging content",
        tools=[],
        llm="gpt-4"
    )
    
    results = []
    
    for topic in topics:
        task = Task(
            description=f"Write comprehensive article about {topic}",
            agent=writer,
            expected_output="Polished article"
        )
        
        crew = Crew(
            agents=[writer],
            tasks=[task],
            verbose=False
        )
        
        result = await crew.kickoff_async(inputs={"topic": topic})
        results.append({
            "topic": topic,
            "content": result.pydantic_object
        })
    
    return results

# Generate content for multiple topics
topics = [
    "Introduction to Autonomous Agents",
    "Building Multi-Agent Systems",
    "Deploying AI Agents in Production",
    "Agent Collaboration Patterns"
]

results = asyncio.run(generate_content_batch(topics))

# Save results
for result in results:
    with open(f"{result['topic']}.md", "w") as f:
        f.write(result['content'])

Best Practices