Capstone project: Build a complete, production-ready multi-agent research system that researches topics, writes reports, and manages files autonomously.
You will build a Research & Report Generation Agent with multiple specialized agents:
Breaks user request into research subtasks. Creates an actionable plan.
Searches the web, reads pages, extracts key information, cites sources.
Synthesizes research into a well-structured, compelling report.
Checks quality, suggests improvements, validates facts and citations.
User: "Research quantum computing breakthroughs in 2025." Planner: Creates plan (what to search, how to structure report). Researcher: Searches, reads articles, extracts insights. Writer: Turns research into a polished 1500-word report. Reviewer: Checks for accuracy, quality, and cites all sources. Output: Final markdown report saved to file.
Here's the system architecture:
┌─────────────────────────────────────┐
│ USER INPUT: Research Topic │
└──────────────┬──────────────────────┘
│
┌──────▼─────────┐
│ PLANNER AGENT │
│ (Orchestrator) │
└──────┬─────────┘
│
┌────────┴────────┐
│ │
TASK 1 TASK 2 TASK N...
(Research (Research (Research
subtopic1) subtopic2) subtopicN)
│ │ │
▼ ▼ ▼
RESEARCHER AGENT (parallel or sequential)
├─ web_search()
├─ read_page()
└─ extract_key_info()
│
▼
┌─────────────────────────┐
│ RESEARCH RESULTS │
│ (facts, citations) │
└────────────┬────────────┘
│
┌──────▼──────────┐
│ WRITER AGENT │
│ (Synthesizer) │
└──────┬──────────┘
│
┌──────▼──────────┐
│ REVIEWER AGENT │
│ (Critic) │
└──────┬──────────┘
│
┌──────▼──────────────────┐
│ FINAL REPORT (markdown) │
│ Saved to file │
└─────────────────────────┘
The first agent creates a detailed plan for the research.
class PlannerAgent: def plan(self, research_goal: str) -> list: """Create a research plan.""" prompt = f"""Research Goal: {research_goal} Create a detailed research plan with 4-5 specific subtasks. Each subtask should be actionable and specific. Format your response as: RESEARCH PLAN ============== Subtask 1: [specific search/research task] Subtask 2: [specific search/research task] ... Include: - What to search for - Types of sources to prioritize - Key concepts to explore - Expected report length Be detailed and strategic.""" response = client.messages.create( model="claude-opus-4-6", max_tokens=2048, system="You are an expert research strategist. Create detailed research plans.", messages=[{"role": "user", "content": prompt}] ) plan_text = response.content[0].text # Parse subtasks from response subtasks = [] for line in plan_text.split("\n"): if "Subtask" in line: subtasks.append(line) return subtasks
The researcher searches, reads, and extracts key findings.
class ResearcherAgent: def research(self, subtask: str) -> dict: """Research a subtask and extract findings.""" # Step 1: Extract search query from subtask extract_prompt = f"Extract the search query from: {subtask}" query_response = client.messages.create(...) search_query = query_response.content[0].text.strip() # Step 2: Search the web search_results = web_search(search_query) # Step 3: Read top pages findings = [] for result in search_results[:3]: page_content = read_page(result["url"]) # Step 4: Extract key info extract_prompt = f"""From this article about {search_query}: {page_content[:1000]} Extract: - 2-3 key facts - Important statistics - Relevant quotes - Source URL Format as markdown.""" extraction = client.messages.create(...) findings.append({ "url": result["url"], "findings": extraction.content[0].text }) return { "subtask": subtask, "search_query": search_query, "findings": findings }
The writer synthesizes all research into a polished report.
class WriterAgent: def write_report(self, topic: str, research_findings: list) -> str: """Write a comprehensive report.""" # Compile all findings into one document compiled_findings = "\n\n".join( [f.get("findings", "") for f in research_findings] ) prompt = f"""Topic: {topic} Research Findings: {compiled_findings} Write a comprehensive, well-structured report (1000-1500 words). Structure: 1. Executive Summary (150 words) 2. Background & Context 3. Key Findings (main sections) 4. Analysis & Implications 5. Conclusion 6. Sources (cite URLs from findings) Style: - Professional but accessible - Well-organized with clear headings - Data-driven with proper citations - Balanced perspective Output in Markdown format.""" response = client.messages.create( model="claude-opus-4-6", max_tokens=4096, system="You are an expert report writer. Create insightful, well-researched reports.", messages=[{"role": "user", "content": prompt}] ) return response.content[0].text
The reviewer checks quality and suggests improvements before delivery.
class ReviewerAgent: def review(self, report: str) -> dict: """Review report quality and suggest improvements.""" prompt = f"""Review this report: {report[:2000]}... Evaluate: 1. Structure and organization 2. Clarity and readability 3. Factual accuracy (are claims supported?) 4. Citation quality 5. Completeness Provide: - Overall quality score (1-10) - Key strengths (2-3) - Areas for improvement (2-3) - Specific revision suggestions Format as JSON.""" response = client.messages.create( model="claude-opus-4-6", max_tokens=2048, system="You are a critical editor. Provide honest, constructive feedback.", messages=[{"role": "user", "content": prompt}] ) try: feedback = json.loads(response.content[0].text) except: feedback = {"raw_feedback": response.content[0].text} return feedback
The main orchestration loop coordinates all agents.
class ResearchPipeline: def __init__(self): self.planner = PlannerAgent() self.researcher = ResearcherAgent() self.writer = WriterAgent() self.reviewer = ReviewerAgent() def run(self, research_goal: str, output_file: str): """Execute the full pipeline.""" print(f"Starting research: {research_goal}") # 1. PLAN print("[1/5] Planning research...") subtasks = self.planner.plan(research_goal) print(f"Created {len(subtasks)} research subtasks") # 2. RESEARCH (parallel or sequential) print("[2/5] Conducting research...") all_findings = [] for subtask in subtasks: findings = self.researcher.research(subtask) all_findings.append(findings) print(f"Completed research from {len(all_findings)} sources") # 3. WRITE print("[3/5] Writing report...") report = self.writer.write_report(research_goal, all_findings) # 4. REVIEW print("[4/5] Reviewing quality...") feedback = self.reviewer.review(report) print(f"Quality score: {feedback.get('score', 'N/A')}/10") # 5. SAVE print("[5/5] Saving report...") with open(output_file, "w") as f: f.write(report) print(f"Report saved to {output_file}") return { "goal": research_goal, "subtasks": len(subtasks), "feedback": feedback, "output_file": output_file } # USAGE pipeline = ResearchPipeline() result = pipeline.run( "Research the current state of quantum computing", "quantum_computing_report.md" )
Here's what happens when you run the agent system:
Starting research: Research the current state of quantum computing [1/5] Planning research... Created 5 research subtasks: - Subtask 1: Search for recent quantum computing breakthroughs (2024-2025) - Subtask 2: Explore major quantum computing companies and their progress - Subtask 3: Investigate quantum computing challenges and limitations - Subtask 4: Research applications of quantum computing in industry - Subtask 5: Examine the timeline for commercial quantum advantage [2/5] Conducting research... Researching subtask 1: 3 sources found Researching subtask 2: 3 sources found Researching subtask 3: 3 sources found Researching subtask 4: 3 sources found Researching subtask 5: 3 sources found Completed research from 15 sources [3/5] Writing report... Report ready: 1,247 words Structure: Executive Summary, Background, Key Findings, Analysis, Conclusion [4/5] Reviewing quality... Quality score: 9/10 Strengths: Well-researched, clear structure, good citations Suggestions: Add more on near-term applications [5/5] Saving report... Report saved to quantum_computing_report.md ===== FINAL REPORT ===== # The Current State of Quantum Computing: 2025 Analysis ## Executive Summary Quantum computing has reached a critical inflection point in 2025... [report continues...] ## Sources - IBM Quantum Research: https://... - Google Quantum AI: https://... [more sources...]
Once you have the basic system working, here are ways to extend it:
Store intermediate results in a database. Enable resumability if agents fail.
Require human approval before certain actions (publishing, modifying files).
Track agent performance, cost, latency. Build a dashboard.
Add a Flask/FastAPI interface so users can trigger research through a web form.
Add a fact-checker agent, translator agent, or presentation-building agent.
Let users chat with agents during the process, modify plan, or ask clarifying questions.
1. In this project, what does the Planner Agent do?
2. What's the purpose of the Reviewer Agent?
3. How does the pipeline flow work?
You've mastered AI agents! You understand what they are, how they work internally, how to build them from scratch, and how to orchestrate multiple agents to solve complex problems. You're now equipped to build production-ready AI agent systems.
Phase 3: AI Agents covered everything from theory to practice. You learned that agents are autonomous systems that perceive, reason, act, and learn. You explored agent architecture: planning, memory, tools, and error recovery. You evaluated frameworks (LangChain, CrewAI, Claude SDK) and understood when to use them vs. building custom agents. You built a complete agent from scratch in pure Python, understanding every component. You orchestrated multi-agent systems with the supervisor, pipeline, and debate patterns. You implemented a full-stack research pipeline with four specialized agents working together.
Topics 18-20 (Phase 4) will cover advanced topics: prompt injection & security, production deployment, and real-world case studies. But you've achieved the core mastery of agents. Congratulations!