★ Final Challenge

Run the Team

50 pts

Your system is complete: role-prompted specialists from make_agent, a researcher → writer pipeline, a critic that bounces weak drafts back under a hard budget, and a router in front. The final challenge is the engine of that system as one pure function — the pipeline threading of run_pipeline fused with the bounded revision of revise_until_approved, producing the append-only transcript from the shared-state lesson. As always, the LLMs arrive as injected callables; the tests stub every one.

Implement run_team(task, pipeline, critic, max_rounds):

  • pipeline is a non-empty list of (name, agent) pairs; each agent takes one string and returns one string. Thread task through the pipeline exactly like run_pipeline: first agent gets task, each next agent gets the previous output. Record each step as (name, output) in a transcript list.
  • Then review: critic(current_output) returns None to approve or a feedback string. On approval, stop. On feedback, call the last pipeline agent with the feedback string, append the new (last_agent_name, output) step to the transcript, and review again.
  • Perform at most max_rounds critic reviews — a never-approving critic gets exactly max_rounds reviews and max_rounds revisions, then the team ships what it has.
  • Return the full transcript. The team's answer is transcript[-1][1].
  • You may assume max_rounds >= 1.

Log in to submit a solution and earn points.