Agent Foundry
All Problems

#77. Sequential Agent Pipeline

EasyMulti-AgentOrchestration

The Problem

You have two agents — a researcher that gathers key facts about a topic and a writer that produces a polished summary. Right now they run independently: the writer generates a summary from scratch instead of using the researcher's findings. The result is a summary that doesn't reflect the actual research. Your job is to wire them into a sequential pipeline so the researcher runs first and its output feeds directly into the writer.

Examples

Example 1

User input: Topic: AI agents

Current (bad) output: The researcher produces five solid findings about AI agents. The writer independently writes a generic summary that doesn't mention any of those findings.

Expected (good) output: The researcher produces five findings. The writer receives those findings and writes a summary that references and synthesizes them.

Example 2

User input: Topic: quantum computing

Current (bad) output: Two disconnected outputs — research notes and a summary that cover different aspects of quantum computing.

Expected (good) output: A summary that directly draws from the researcher's specific notes on quantum computing, maintaining factual consistency.

Your Task

Refactor the starter code so that:

  • The researcher agent runs first and produces its findings.
  • The writer agent receives the researcher's output as context/input.
  • The final output is a summary grounded in the actual research findings.
  • Both agents remain separate (do not merge them into one).

Evaluation

Submissions are checked for the following:

  • Sequential execution order: The researcher runs first and the writer runs second.
  • Research context flows to writer: The writer's input includes the researcher's output so the summary is grounded in actual research.
  • Coherent final summary: The final summary clearly reflects the specific findings from the research step.

Constraints

  • The researcher agent must run before the writer agent
  • The writer must receive the researcher's output as input
  • You may not merge both roles into a single agent
  • The pipeline must run end-to-end with a single invocation
Starter Code
from crewai import Agent, Task, Crew
from crewai import LLM

llm = LLM(model="gpt-4o-mini")

researcher = Agent(
    role="Researcher",
    goal="Gather key facts about a given topic",
    backstory="You are a thorough research analyst.",
    llm=llm,
)

writer = Agent(
    role="Writer",
    goal="Write a concise summary from research notes",
    backstory="You are a skilled technical writer.",
    llm=llm,
)

research_task = Task(
    description="Research the latest trends in {topic}",
    expected_output="A list of 5 key findings with brief explanations",
    agent=researcher,
)

write_task = Task(
    description="Write a 200-word summary about {topic}",
    expected_output="A polished summary paragraph",
    agent=writer,
)

# BUG: Both tasks run independently — the writer never sees the research
# TODO: Wire the tasks so the writer receives the researcher's output
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
)

result = crew.kickoff(inputs={"topic": "AI agents"})
print(result)
Open in Google Colab
Evaluation Criteria0/3