#32The whole system, expressedMedium

The whole system, expressed

Background

Stripped of nouns, one research run is four verbs in sequence: decompose → execute → combine → check. (Retry is the orchestrator's extra loop, Lesson 8; this is the single pass.)

sub_questions = plan(query)
findings      = {sq: execute(sq) for sq in sub_questions}
answer        = synthesize(query, findings)
passed, _     = critique(query, findings, answer)

Problem statement

Implement research_pipeline(query, plan, execute, synthesize, critique) returning (answer, passed).

Input

  • query — the research question.
  • plan — callable query -> list[str] of sub-questions.
  • execute — callable sub_question -> str (a finding).
  • synthesize — callable (query, findings) -> str (the answer).
  • critique — callable (query, findings, answer) -> (passed: bool, gaps: list).

Output

Returns (answer, passed):

  1. sub_questions = plan(query),
  2. findings = {sq: execute(sq) for sq in sub_questions},
  3. answer = synthesize(query, findings),
  4. passed, _ = critique(query, findings, answer).

Examples

plan       -> ["a", "b"]
execute    -> (sq -> f"F-{sq}")
synthesize -> (q, f -> "ANSWER")
critique   -> (q, f, a -> (True, []))
research_pipeline(...)  ->  ("ANSWER", True)

Constraints

  • Execute every sub-question (in plan order) into a {sq: finding} dict.
  • Synthesize from all findings, then critique.
  • Return (answer, passed).

Notes

  • Five classes, four verbs, one pass. This is the entire multi-agent system before the retry loop wraps it.
Python
Loading...

▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.

  • Reference example: happy path returns (answer, True)
  • Sample: fail verdict propagates
  • Reference example: every sub-question executed in order