> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-redirect-agent-platform-overview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Iterative Workflow

> Quality-driven processes requiring repetition until specific conditions are met

**Example Use-Cases**: Quality improvement loops, retry mechanisms, iterative refinement

Iterative workflows provide controlled repetition with deterministic exit conditions, ensuring consistent quality standards.

<img className="block dark:hidden" src="https://mintcdn.com/phidatainc-redirect-agent-platform-overview/7T6Z7KMTMhNdtk6c/images/workflows-loop-steps-light.png?fit=max&auto=format&n=7T6Z7KMTMhNdtk6c&q=85&s=3838e0394a70009a86344d964efd32ff" alt="Workflows loop steps diagram" width="3441" height="756" data-path="images/workflows-loop-steps-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/phidatainc-redirect-agent-platform-overview/7T6Z7KMTMhNdtk6c/images/workflows-loop-steps.png?fit=max&auto=format&n=7T6Z7KMTMhNdtk6c&q=85&s=cd18defaeaa5ac2eb08cf46818286728" alt="Workflows loop steps diagram" width="3441" height="756" data-path="images/workflows-loop-steps.png" />

## Example

```python iterative_workflow.py theme={null}
from agno.workflow import Loop, Step, Workflow

def quality_check(outputs) -> bool:
    # Return True to break loop, False to continue
    return any(len(output.content) > 500 for output in outputs)

workflow = Workflow(
    name="Quality-Driven Research",
    steps=[
        Loop(
            name="Research Loop",
            steps=[Step(name="Deep Research", agent=researcher)],
            end_condition=quality_check,
            max_iterations=3
        ),
        Step(name="Final Analysis", agent=analyst),
    ]
)

workflow.print_response("Research the impact of renewable energy on global markets", markdown=True)
```

## Iteration Output Forwarding

By default, each iteration receives the previous iteration's output as its input (`forward_iteration_output=True`). This enables iterative accumulation patterns where each pass builds on the previous result. Set `forward_iteration_output=False` if all iterations should receive the original loop input instead.

## Developer Resources

* [Loop Steps Workflow](/workflows/usage/loop-steps-workflow)
* [Loop Iterative Accumulation](/workflows/usage/loop-iterative-accumulation)

## Reference

For complete API documentation, see [Loop Steps Reference](/reference/workflows/loop-steps).
