CrewAI Multi-Agent Playbook: Build a Writing Factory
One agent writing an article is a single point of inspiration, but a team of specialist agents can behave like a content engine. CrewAI makes this practical by composing autonomous agents with defined roles, shared tasks, and a workflow that hands work from one specialist to the next. In this playbook you will build a writing factory: a research agent gathers facts, a writer drafts the piece, an editor tightens the prose, and a fact-checker verifies claims before the final deliverable ships. The result is a pipeline that produces consistent blog posts while each agent focuses on the step it does best.
Designing the crew
The core of any crew is the role, goal, and backstory triad you give to each agent. These three fields shape the system prompt that drives behaviour, so write them as if you were briefing a real collaborator. A research agent should have a goal of digging up sources and a backstory as a meticulous analyst; the writer should be opinionated and fluent; the editor should be ruthless about clarity. Keep the backstories grounded so the agents do not drift into fantasy: a model performs best when its persona matches the task constraints.
Keep the same discipline across all four roles, and it pays off:
- Role should name who the agent is, not what the pipeline stage is called.
- Goal belongs in the active voice and stays within the scope of one responsibility.
- Backstory is a short flavour paragraph that grounds the persona without inventing fake credentials.
- Reuse the easiest wording that still triggers reliable behaviour, so prompts stay cheap to maintain.
A task is the unit of work an agent executes. Each task declares a description, an expected output, and an optional context, allowing you to pipe the result of one task into the next. This chaining is what turns independent agents into a pipeline. In code, define the agents, then define tasks that reference those agents and their expected outputs, and finally let a CrewProcess orchestrate the order.
from crewai import Agent, Task, Crew, Process
researcher = Agent(
role="Senior Research Analyst",
goal="Gather reliable sources and key facts",
backstory="A meticulous analyst who verifies every claim.",
)
writer = Agent(
role="Technical Writer",
goal="Turn research into a clear draft",
backstory="A fluent writer who explains complex ideas simply.",
)
draft = Task(
description="Write a 1000-word article from the research",
expected_output="A polished article draft",
agent=writer,
)
crew = Crew(agents=[researcher, writer],
tasks=[research_task, draft],
process=Process.sequential)
result = crew.kickoff()
Tooling and outputs that keep agents honest
Agents are only as useful as the tools and formats you let them use. Give each agent a narrow set of tools rather than a kitchen-sink list, because every extra capability is another surface for a model to misuse. The research agent, for example, benefits from a web-search tool and a page-fetch tool, but has no business calling a document writer. Lock the scope down with the tools argument so an agent cannot wander outside its lane.
Equally important is a structured output contract. Instead of asking for free-form prose, require each task to emit a defined block. A research task can return a JSON object with sources, facts, and gaps; an editing task can return a list of suggested changes. Structured hand-offs make the downstream prompt deterministic and the pipeline much easier to debug, because you can inspect exactly what flowed from one agent to the next when something comes out wrong.
Running the sequential pipeline
In a sequential process, tasks execute in the order you define them, and each task can reference the outputs of earlier tasks through templates. The research task should emit a structured brief with bullet points and source links; the writer task then consumes that brief as {research_output} context. Because the briefing document is concrete, the writer generates a draft grounded in real facts instead of hallucinated ones.
The single biggest quality lever in a multi-agent system is the hand-off document. The better a task describes exactly what it needs from the previous agent, the less guesswork the downstream model has to do.
Use the Delegate tool sparingly. CrewAI agents can delegate subtasks to each other, but reckless delegation creates loops and ballooning token spend. For a writing factory, sequential hand-offs are clearer and easier to debug than a free-for-all. If you need parallel work, the hierarchical process lets a manager agent allocate tasks to matching agents and then review the combined result.
Fact-checking and quality gates
Generation speed is meaningless if the content is wrong. Add a verification task that receives the draft and returns a scorecard of claims, marking each as verified, uncertain, or false. When a claim is unverified, the final task can either flag it for a human or drop it. This is your quality gate: it catches the confident-sounding errors that a single-shot writer would ship silently.
Every agent call has a cost and latency, so respect your budget. Run the cheap in-context tasks first, and treat the expensive executor models as the ones that run once on the rich final prompt. Cache shared context and reuse full task results instead of allowing redundant re-runs. Measure the total time and token count of a typical run using the crew output, then tune the structure until the cost per finished article sits where you want it.
A lightweight memory matters more than you might expect. CrewAI provides a short-term memory that lets a later task reference what earlier agents produced, and a long-term memory that persists lessons across runs. Enabling both means the fact-checker can recall that a particular source was already flagged as unreliable in a previous session instead of re-verifying it from scratch, which trims both latency and token cost on every subsequent run.
Also tune the temperature. Research and fact-checking tasks prefer a low temperature so they report faithfully, while the drafting task can afford a slightly higher one for more natural prose. Baking these settings into each task, rather than leaving a single global value, lets you keep every stage honest without flattening the writer.
A practical writing recipe
A robust default recipe has five tasks. Recover a topic brief, research it into a fact file, outline the article with sections, draft the prose, then edit and fact-check the result. Run this crew on a varied set of subjects to calibrate prompts, and keep a library of reusable task templates. When a run produces genuinely good work, inspect the trace to see which agent contributed the strongest input so you can reinforce that step. With a tuned crew, producing ten posts no longer takes ten times the effort; it takes one well-oiled pipeline.



