# Hi, how to have agent complete task multiple time? With different outputs (to file)

**URL:** <https://community.crewai.com/t/hi-how-to-have-agent-complete-task-multiple-time-with-different-outputs-to-file/2090>\
**Category:** General\
**Created:** [December 16, 2024, 8:15pm UTC](https://community.crewai.com/t/hi-how-to-have-agent-complete-task-multiple-time-with-different-outputs-to-file/2090 "2024-12-16T20:15:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Ryan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/daniel_ryan/32/1339_2.png) [@Daniel\_Ryan](https://community.crewai.com/u/Daniel_Ryan)\
**Post date:** [December 16, 2024, 8:15pm UTC](https://community.crewai.com/t/hi-how-to-have-agent-complete-task-multiple-time-with-different-outputs-to-file/2090/1 "2024-12-16T20:15:40Z")

</div>

Hi, does anyone know how to have a task executed in a loop.

Use case is  
Agent 1 will provide a high level lesson plan  
Agent 2 will provide the low level lesson detail

I want to output agents 2’s low level lesson detail for each lesson in the high level lesson plan.

For example

High Level Plan  
Lesson 1 Blah  
Lesson 2 Bleh

Low Level Lesson 1 = Blah Blah blah  
Low Level Lesson 2 = Bleh Bleh bleh

Thanks in advance!!

---

<div class="post-metadata">

**Author:** ![Dule\_pan](https://avatars.discourse-cdn.com/v4/letter/d/fbc32d/32.png) [@Dule\_pan](https://community.crewai.com/u/Dule_pan)\
**Post date:** [December 17, 2024, 7:53am UTC](https://community.crewai.com/t/hi-how-to-have-agent-complete-task-multiple-time-with-different-outputs-to-file/2090/2 "2024-12-17T07:53:16Z")

</div>

Hey, O think that the YouTube video will help you do exactly that: CrewAI Flows Crash Course, from CodeWithBrandon. The last chapter of the video is about writing book with chapters. So think that it is exactly the same case scenario as yours, but with small difference, diff jlin topic.
