CrewAI: Build a Research-to-Draft Pipeline (2026)
๐ Quick start
- Install CrewAI and scaffold a project with the CLI.
- Define three agents in agents.yaml with short, role-focused goals.
- Wire four tasks in tasks.yaml using the context key for handoffs.
- Force the Researcher to output a JSON source table, then let the Writer cite by source id.
๐ก Why use CrewAI for this
CrewAI is an open-source Python framework for orchestrating role-based LLM agents into sequential or hierarchical crews. For content teams, the practical workflow is a three-agent pipeline โ Researcher, Writer, Editor โ where each agent reads the previous agent's output and passes structured data forward. The trick most people miss is forcing the Researcher to emit a JSON source table, not prose, so the Writer can't hallucinate citations and the Editor has something concrete to verify against. You need Python 3.10+, a CrewAI install, and an API key for any LLM backend (OpenAI, Anthropic, or a local model via Ollama). No paid CrewAI plan is required for the code-first path โ the open-source Python package is free. Pricing and feature details checked 2026-10-15.
๐ ๏ธ How to Build a Research-to-Draft Pipeline (4 steps)
Step 1
Open your terminal in a new empty folder and run 'crewai create crew content_pipeline'. This scaffolds a project with a config/ folder containing agents.yaml and tasks.yaml, plus crew.py and main.py.
Step 2
Open config/agents.yaml and define three agents. Give each a role, goal, and backstory. Set the Researcher's goal to 'produce a structured JSON source table with at least 6 sources', the Writer's goal to 'write a 1400-word explainer citing every claim by source id', and the Editor's goal to 'verify every citation and flag unsupported claims'. Keep each backstory to two sentences โ long backstories waste tokens.
Step 3
Open config/tasks.yaml and define four tasks in order: research_task (assigned to Researcher, output expected as JSON), write_task (assigned to Writer, with context set to research_task), fact_check_task (assigned to Editor, context set to both prior tasks), and revise_task (assigned to Writer, context set to fact_check_task). The 'context' key is what wires the handoff โ without it, agents work blind.
Step 4
In crew.py, set process=Process.sequential and set allow_delegation=False on every agent for this pipeline. Delegation sounds impressive but in a linear content pipeline it causes agents to hand work back and forth and blow your token budget. Also set max_iter=3 on the Writer so it can't loop indefinitely on a hard topic.
๐ฆ What you'll get
After a successful run, you receive a markdown draft with bracketed source ids (e.g., [S3]) and a fact-check table listing each claim, its cited source, a verdict (verified/unsupported/rewritten), and a note. The exact word count, citation density, and error rate depend on your model and topic.
๐ฐ Pricing (checked 2026-10-15)
| Plan | Price | What you get for this workflow | Official link |
|---|---|---|---|
| Plan | Price |
What you get | pricing โ |
| Open-source CrewAI | Free |
Python package, CLI, sequential and hierarchical crews, no hosted dashboard | pricing โ |
| CrewAI Enterprise | Contact sales |
Hosted platform, managed deployments, team features | pricing โ |
๐ Copy-paste prompts
"Research [TOPIC] for an audience of [AUDIENCE]. Return ONLY a JSON array. Each item must have keys: id (S1, S2...), claim (one sentence), source_url (a real URL you fetched), confidence (high/medium/low). Minimum 6 items. No prose, no preamble."
"Using only the source table provided, write a [WORD COUNT]-word explainer on [TOPIC] for [AUDIENCE]. Every factual claim must end with its source id in square brackets, like [S3]. If a claim has no matching source id, do not make the claim. Open with a 40-word dek, then H2 sections."
"Review the draft against the source table. For every bracketed citation, confirm the claim matches the source summary. Output a markdown table with columns: claim, cited source, verdict (verified/unsupported/rewritten), note. Then list every claim in the draft that has no citation at all."
โ ๏ธ Common mistakes
โ๏ธ CrewAI vs Alternatives
| Tool | Price | Best For | Verdict |
|---|---|---|---|
Free open-source; LangSmith paid plans start at $39/month (checked 2026-10-15) |
Developers who want lower-level control over chains and integrations. | ||
Free open-source (checked 2026-10-15) |
Conversational multi-agent research and coding workflows. |
โ Frequently Asked Questions
Q: Is CrewAI free?
The open-source Python package is free. CrewAI Enterprise is a separate paid offering; this guide uses only the open-source path. Checked 2026-10-15.
Q: Do I need an OpenAI API key to use CrewAI?
No. CrewAI supports multiple LLM backends, including Anthropic and local models via Ollama. You need an API key or local endpoint for whichever backend you choose.
Q: What Python version does CrewAI require?
Python 3.10 or newer.
Q: Can CrewAI agents browse the web for sources?
CrewAI supports tools, including search and scraping tools, but you must configure them. The Researcher prompt in this guide assumes you have a tool that can fetch real URLs.
Q: How do I stop agents from hallucinating citations?
Force the Researcher to output a JSON source table with real URLs, then instruct the Writer to cite only by source id and to omit any claim without a matching id. The Editor then verifies each citation against the table.
๐ Level up your AI toolkit
Understand AI in 5 minutes a day. No jargon. No hype. Unsubscribe anytime.