Rahul-8799 commited on
Commit
42009e1
·
verified ·
1 Parent(s): 5ff84ae

Update utils/run_pipeline_and_save.py

Browse files
Files changed (1) hide show
  1. utils/run_pipeline_and_save.py +28 -20
utils/run_pipeline_and_save.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  from agents import (
2
  product_manager_agent,
3
  project_manager_agent,
@@ -5,33 +7,39 @@ from agents import (
5
  software_engineer_agent,
6
  quality_assurance_agent,
7
  )
8
- import os
9
- import json
10
 
11
- os.makedirs("output", exist_ok=True)
 
12
 
13
- def run_pipeline_and_save(prompt):
14
- log = []
15
 
16
- pm_out = product_manager_agent.run(prompt)
17
- log.append({"Product Manager": pm_out})
 
18
 
19
- proj_out = project_manager_agent.run(pm_out)
20
- log.append({"Project Manager": proj_out})
 
21
 
22
- arch_out = software_architect_agent.run(proj_out)
23
- log.append({"Software Architect": arch_out})
 
24
 
25
- eng_out = software_engineer_agent.run(arch_out)
26
- log.append({"Software Engineer": eng_out})
 
27
 
28
- qa_out = quality_assurance_agent.run(eng_out)
29
- log.append({"QA": qa_out})
 
30
 
31
- with open("output/agent_log.json", "w") as f:
32
- json.dump(log, f, indent=2)
 
33
 
34
- with open("output/final_output.html", "w") as f:
35
- f.write(eng_out)
 
36
 
37
- return log, eng_out
 
1
+ import os
2
+ import json
3
  from agents import (
4
  product_manager_agent,
5
  project_manager_agent,
 
7
  software_engineer_agent,
8
  quality_assurance_agent,
9
  )
 
 
10
 
11
+ OUTPUT_DIR = "output"
12
+ os.makedirs(OUTPUT_DIR, exist_ok=True)
13
 
14
+ def run_pipeline_and_save(prompt: str):
15
+ chat_log = []
16
 
17
+ # Step 1: Product Manager
18
+ pm_output = product_manager_agent.run(prompt)
19
+ chat_log.append({"Product Manager": pm_output})
20
 
21
+ # Step 2: Project Manager
22
+ proj_output = project_manager_agent.run(pm_output)
23
+ chat_log.append({"Project Manager": proj_output})
24
 
25
+ # Step 3: Software Architect
26
+ arch_output = software_architect_agent.run(proj_output)
27
+ chat_log.append({"Software Architect": arch_output})
28
 
29
+ # Step 4: Software Engineer
30
+ eng_output = software_engineer_agent.run(arch_output)
31
+ chat_log.append({"Software Engineer": eng_output})
32
 
33
+ # Step 5: Quality Assurance
34
+ qa_output = quality_assurance_agent.run(eng_output)
35
+ chat_log.append({"Quality Assurance": qa_output})
36
 
37
+ # Save final UI output files
38
+ with open(os.path.join(OUTPUT_DIR, "index.html"), "w") as f:
39
+ f.write(eng_output)
40
 
41
+ # Save chat log
42
+ with open(os.path.join(OUTPUT_DIR, "agent_log.json"), "w") as f:
43
+ json.dump(chat_log, f, indent=2)
44
 
45
+ return chat_log, eng_output