CrewAI is an advanced framework designed to optimize the orchestration of multiple AI agents for a wide variety of tasks, including automation, content generation, data extraction, and more. It allows the seamless coordination of independent agents, enabling them to collaborate and complete tasks that require different capabilities, such as data research, content writing, and specialized tasks like SEO optimization.
At the core of CrewAI’s functionality is its multi-agent architecture, where each agent is assigned specific roles or functions. These agents communicate and cooperate to execute workflows that involve complex tasks, making CrewAI particularly useful for tasks like content creation, marketing automation, research, and many other domains.
Courtesy: https://docs.crewai.com/
The CrewAI Blog Writer leverages CrewAI's multi-agent framework to automate the entire blog creation process. By using specialized agents for each step of content creation—research, writing, and editing—the CrewAI Blog Writer ensures that the generated blog posts are not only high-quality but also SEO-friendly and well-researched.
The CrewAI Blog Writer is built upon LangChain for model orchestration and CrewAI for managing the agents. Each agent is defined with its own role, task, and backstory, ensuring they perform their respective functions effectively. For example, the Researcher agent is set up with a specific goal of gathering insights from trusted sources, while the Writer agent focuses on drafting high-quality content.
This system is highly customizable, allowing you to adjust agent roles, tasks, and even integrate custom models or tools to further refine the blog creation process. The result is an efficient, scalable solution for automating the entire content creation process while maintaining high quality and relevance.
In summary, the CrewAI Blog Writer offers a comprehensive solution for businesses and individuals seeking to generate high-quality blog content efficiently and consistently. By automating the workflow and incorporating advanced language models, it ensures that every piece of content is thoroughly researched, expertly written, and optimized for SEO.
Before you can run the CrewAI Blog Writer locally with the DeepSeek-R1 model via the vLLM server, ensure you meet the following requirements:
(vllm-env) (base) ranjan@aileaderx:/mnt/d/vllm-env$ python3 -m vllm.entrypoints.openai.api_server \
--model deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B \
--host 0.0.0.0 \
--port 8888 \
--device cuda \
--gpu-memory-utilization 0.85 \
--max-model-len 32768 \
--max-num-seqs 1 \
--tensor-parallel-size 1 \
--swap-space 8
For detailed setup instructions, please refer to the full guide available at: vLLM Chatbot Setup Guide
Follow these steps to install Crew AI and set up your environment for the CrewAI Blog Writer:
(base) ranjan@aileaderx:/mnt/d/crewai$ conda create -n crewai_env python=3.11
(base) ranjan@aileaderx:/mnt/d/crewai$ conda activate crewai_env
(crewai_env) ranjan@aileaderx:/mnt/d/crewai$
(crewai_env) ranjan@aileaderx:/mnt/d/crewai$ pip install crewai
(crewai_env) ranjan@aileaderx:/mnt/d/crewai$ pip install 'crewai[tools]'
(crewai_env) ranjan@aileaderx:/mnt/d/crewai$ pip install langchain_community
For detailed installation steps, please refer to the official CrewAI Installation Guide.
This Python code initializes a multi-agent workflow using CrewAI and LangChain. Each agent (Researcher, Writer, Editor) is assigned a specific role in transforming factual data into an optimized blog post.
"""
Copyright (c) 2025 AI Leader X (aileaderx.com). All Rights Reserved.
This software is the property of AI Leader X. Unauthorized copying, distribution,
or modification of this software, via any medium, is strictly prohibited without
prior written permission. For inquiries, visit https://aileaderx.com
"""
# Import necessary modules from CrewAI, LangChain, and utility libraries
from crewai import Agent, Task, Crew # Core components for defining agents, tasks, and crew orchestration
from crewai_tools import ScrapeWebsiteTool # Tool for scraping content from a specified website
from langchain_community.chat_models import ChatOpenAI # LangChain connector to interface with OpenAI-compatible models (like vLLM)
import warnings # Suppresses runtime warnings for a cleaner console output
# Disable all warning messages to avoid clutter in logs
warnings.filterwarnings('ignore')
# -------------------------------------------
# 🔗 Step 1: Connect to Local LLM (vLLM Server)
# -------------------------------------------
# Use LangChain's ChatOpenAI interface to connect to a locally hosted DeepSeek-R1 model via OpenAI-compatible vLLM API
local_llm = ChatOpenAI(
model="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B", # Model name
base_url="http://localhost:8888/v1", # Local API endpoint (vLLM)
api_key="test-key", # Dummy key; vLLM does not enforce API keys
temperature=0.7 # Controls response creativity
)
# -------------------------------------------
# 🧠 Step 2: Define Agents with Specific Roles
# -------------------------------------------
# Agent 1: Researcher – Responsible for extracting facts and bullet-point insights
researcher = Agent(
role="Generative AI Analyst",
goal="Extract high-quality, accurate insights related to generative AI's role in 2025 software engineering",
backstory="An expert in AI research who can mine insights from trusted sources with precision.",
allow_delegation=False, # Prevent agent from handing off its task
verbose=True, # Enables agent to print its thought process
llm=local_llm # Connect this agent to the local LLM
)
# Agent 2: Writer – Converts insights into a well-structured article
writer = Agent(
role="Technical Blog Writer",
goal="Convert structured research into an engaging blog post about a given topic",
backstory="An experienced content creator who excels at turning research into readable blog articles.",
allow_delegation=False,
verbose=True,
llm=local_llm
)
# Agent 3: Editor – Enhances tone, clarity, and SEO
editor = Agent(
role="SEO Blog Editor",
goal="Edit blogs for clarity, tone, and SEO with strong meta tags and keyword optimization",
backstory="A skilled editor with a knack for making blogs rank higher on search engines.",
allow_delegation=False,
verbose=True,
llm=local_llm
)
# -------------------------------------------
# 🔧 Step 3: Define Tool(s)
# -------------------------------------------
# A simple web scraper tool that fetches content from Google’s AI blog
scraper = ScrapeWebsiteTool(
website_url="https://blog.google/technology/ai/"
)
# -------------------------------------------
# ✅ Step 4: Define Tasks with Inputs & Tools
# -------------------------------------------
# Task 1: Research – Researcher extracts bullet-point insights from web
research_task = Task(
description=(
"Research and extract factual insights about the topic: '{topic}'. "
"Use the provided website to gather accurate points about how generative AI is transforming software engineering in 2025. "
"Present the findings as bullet points, each with a source reference."
),
expected_output="A bullet-point factual summary with sources, directly related to the given topic.",
tools=[scraper], # Inject scraper tool into task
input_variables=["topic"], # Variables that will be replaced during execution
agent=researcher # Assign this task to the researcher agent
)
# Task 2: Writing – Writer creates the article draft from research
writing_task = Task(
description=(
"Based on the research findings about '{topic}', draft a full-length blog article. "
"Structure it with an engaging introduction, 3-4 meaningful sections, and a compelling conclusion. "
"Ensure the writing is coherent and relevant to 2025 trends in software engineering with generative AI."
),
expected_output="A structured, topic-aligned blog article with clear sections and compelling content.",
input_variables=["topic"],
agent=writer
)
# Task 3: Editing – Editor polishes the blog and optimizes for SEO
editing_task = Task(
description=(
"Polish the blog article related to '{topic}'. Optimize tone, clarity, and add SEO metadata. "
"Include a suitable title, meta-title, and meta-description. Ensure keyword alignment with terms like "
"'Generative AI', 'Software Engineering 2025', etc. Output final content only."
),
expected_output="Final version of the blog post, SEO-enhanced, with meta-title and meta-description.",
input_variables=["topic"],
agent=editor
)
# -------------------------------------------
# 🧩 Step 5: Crew – Orchestrate Agents and Tasks
# -------------------------------------------
crew = Crew(
agents=[researcher, writer, editor], # List of all participating agents
tasks=[research_task, writing_task, editing_task], # Ordered task pipeline
verbose=2, # Print crew-level debug info
memory=False # No long-term memory retention between runs
)
# -------------------------------------------
# 🚀 Step 6: Execute the Workflow
# -------------------------------------------
# Provide topic input that all tasks will use
inputs = {
"topic": "The impact of generative AI on software engineering in 2025"
}
# Run the workflow and print the final result
result = crew.kickoff(inputs=inputs)
print("\n🚀 Final Output:\n", result)
This example orchestrates a powerful, agent-driven workflow—all running locally with no cloud API dependency.
Below is Console Logs generated by the multi-agent CrewAI system.
Below is the final blog content generated by the multi-agent CrewAI system. This includes research-backed content, structured blog formatting, and SEO-optimized metadata.
This CrewAI-based blog writer demonstrates how autonomous agents can collaborate using clearly defined roles to generate high-quality content. By leveraging a local LLM setup via vLLM, it ensures privacy, performance, and cost-efficiency.
The integration of specialized agents—Researcher, Writer, and Editor—shows how LLMs can simulate human editorial workflows in an intelligent and structured manner.
The advantages of this architecture include:
Potential Future Enhancements: