-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_task_master.py
More file actions
154 lines (127 loc) · 5.71 KB
/
Copy pathstart_task_master.py
File metadata and controls
154 lines (127 loc) · 5.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env python3
"""
Task Master Quick Start
Launch Task Master as the central AI project manager for Julep agents
"""
import asyncio
import sys
import os
from pathlib import Path
# Add src to path
sys.path.append(str(Path(__file__).parent / "src"))
# Import Task Master components
from task_master_julep_bridge import (
TaskMasterCommandCenter,
TaskMasterJulepOrchestrator,
demonstrate_task_master_julep_integration
)
async def interactive_task_master():
"""Interactive Task Master session"""
print("\n" * 2)
print("╔" + "═" * 68 + "╗")
print("║" + " " * 20 + "TASK MASTER ACTIVATED" + " " * 27 + "║")
print("║" + " " * 10 + "Central AI Project Manager for Julep Agents" + " " * 14 + "║")
print("╚" + "═" * 68 + "╝")
# Initialize command center
command_center = TaskMasterCommandCenter()
print("\n🎯 Task Master is ready to orchestrate your agents!")
print("=" * 70)
print("\n📋 Available Commands:")
print(" 1. Create task - Create a new task")
print(" 2. Research - Perform deep research")
print(" 3. Scrape - Web scraping task")
print(" 4. Analyze - Analyze data/text")
print(" 5. Workflow - Create complex workflow")
print(" 6. Demo - Run full demonstration")
print(" 7. Exit - Exit Task Master")
while True:
print("\n" + "-" * 70)
choice = input("\n🎯 Enter command (1-7) or describe your task: ").strip()
if choice == "7" or choice.lower() in ["exit", "quit"]:
print("\n👋 Task Master shutting down. Goodbye!")
break
elif choice == "6" or choice.lower() == "demo":
await demonstrate_task_master_julep_integration()
elif choice == "1":
title = input("📝 Task title: ")
description = input("📄 Task description: ")
priority = input("⚡ Priority (low/medium/high/critical) [medium]: ") or "medium"
task = await command_center.orchestrator.create_task(
title=title,
description=description,
priority=priority
)
print(f"\n✅ Task created: {task.id}")
print(f"🔧 Required tools: {', '.join(task.required_tools)}")
execute = input("\n▶️ Execute task now? (y/n): ")
if execute.lower() == 'y':
result = await command_center.router.route_and_execute(task)
print(f"\n📊 Result: {task.status}")
elif choice == "2":
topic = input("🔍 Research topic: ")
result = await command_center.process_user_request(
f"Research {topic} using multiple sources including academic papers"
)
print(f"\n✅ Research completed: {result['status']}")
elif choice == "3":
url = input("🌐 URL to scrape (or description): ")
result = await command_center.process_user_request(
f"Scrape data from {url} using advanced crawling techniques"
)
print(f"\n✅ Scraping completed: {result['status']}")
elif choice == "4":
text = input("📊 Text/data to analyze: ")
analysis_type = input("🧠 Analysis type (sentiment/entities/patterns) [sentiment]: ") or "sentiment"
result = await command_center.process_user_request(
f"Analyze the following for {analysis_type}: {text}"
)
print(f"\n✅ Analysis completed: {result['status']}")
elif choice == "5":
project_name = input("📁 Project name: ")
num_requirements = int(input("📋 Number of requirements: "))
requirements = []
for i in range(1, num_requirements + 1):
req = input(f" Requirement {i}: ")
requirements.append(req)
workflow_id = await command_center.create_project_workflow(
project_name,
requirements
)
print(f"\n✅ Workflow created: {workflow_id}")
else:
# Treat as free-form task description
if choice:
print(f"\n🤔 Processing: {choice}")
result = await command_center.process_user_request(choice)
print(f"\n✅ Task completed: {result['status']}")
else:
print("❌ Invalid input. Please try again.")
print("\n" + "=" * 70)
print("Task Master session ended.")
async def main():
"""Main entry point"""
# Check for command line arguments
if len(sys.argv) > 1:
if sys.argv[1] == "demo":
await demonstrate_task_master_julep_integration()
elif sys.argv[1] == "help":
print("Usage: python start_task_master.py [demo|interactive]")
print(" demo - Run demonstration")
print(" interactive - Start interactive session (default)")
else:
# Process as task request
request = " ".join(sys.argv[1:])
command_center = TaskMasterCommandCenter()
result = await command_center.process_user_request(request)
print(f"\n✅ Task completed: {result['status']}")
else:
# Interactive mode
await interactive_task_master()
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
print("\n\n👋 Task Master interrupted. Goodbye!")
except Exception as e:
print(f"\n❌ Error: {e}")
sys.exit(1)