review_loop

Function review_loop 

Source
pub fn review_loop(
    author: AgentBuilder,
    reviewer: AgentBuilder,
    max_rounds: usize,
) -> Composable
Expand description

Review loop: author writes, reviewer checks, loop until approved.

The author agent produces output, then the reviewer evaluates it. The loop terminates when the reviewer sets "approved" to true in the state, or after max_rounds iterations.

§Arguments

  • author — The agent that produces drafts.
  • reviewer — The agent that evaluates and sets "approved": true when satisfied.
  • max_rounds — Maximum number of author-reviewer cycles.

§Example

let workflow = review_loop(
    AgentBuilder::new("writer").instruction("Write a blog post"),
    AgentBuilder::new("editor").instruction("Review. Set approved=true if publication-ready."),
    3,
);
let agent = workflow.compile(llm);