Spaces:
Runtime error
Runtime error
Create coordinator.py
Browse files- coordinator/coordinator.py +28 -0
coordinator/coordinator.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coordinator/coordinator.py
|
| 2 |
+
|
| 3 |
+
from coordinator.task_parser import parse_brief
|
| 4 |
+
from coordinator.task_assigner import assign_tasks
|
| 5 |
+
|
| 6 |
+
class Coordinator:
|
| 7 |
+
def __init__(self):
|
| 8 |
+
print("[Coordinator] Initialized")
|
| 9 |
+
|
| 10 |
+
def run(self, project_brief: str):
|
| 11 |
+
print(f"[Coordinator] Received project brief: {project_brief}")
|
| 12 |
+
|
| 13 |
+
# Step 1: Parse the brief into tasks
|
| 14 |
+
tasks = parse_brief(project_brief)
|
| 15 |
+
print(f"[Coordinator] Parsed tasks: {tasks}")
|
| 16 |
+
|
| 17 |
+
# Step 2: Assign tasks to sub-agents
|
| 18 |
+
assigned_tasks = assign_tasks(tasks)
|
| 19 |
+
print(f"[Coordinator] Assigned tasks: {assigned_tasks}")
|
| 20 |
+
|
| 21 |
+
return assigned_tasks
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Quick test
|
| 25 |
+
if __name__ == "__main__":
|
| 26 |
+
coord = Coordinator()
|
| 27 |
+
brief = "Build a task management app with user authentication and task sharing"
|
| 28 |
+
coord.run(brief)
|