-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
48 lines (43 loc) · 2.49 KB
/
Copy pathtasks.py
File metadata and controls
48 lines (43 loc) · 2.49 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
from crewai import Task
def create_tasks(profile_manager, availability_checker, optimization_coordinator, participants, target_date):
# Format participants list for description
participants_str = ", ".join([f"{p['name']} ({p['location']})" for p in participants])
task_timezone = Task(
description=(
f"Map the locations of the following participants to standard IANA timezone database strings: {participants_str}. "
"Use the Get Participant Timezone Tool for each participant. Return a JSON mapping of participant name to timezone."
),
expected_output=(
'A JSON string mapping participant names to their resolved IANA timezone strings, e.g. '
'{"Alice": "America/New_York", "Bob": "Europe/London"}'
),
agent=profile_manager
)
task_availability = Task(
description=(
"Retrieve the schedules (working hours and busy slots) for each participant. "
"Use the Get Mock Calendar Events Tool for each participant, passing their resolved timezone as `timezone_str` "
f"and the target date `{target_date}` as `target_date`. "
"Compile all participant details into a single structured JSON object. "
"The keys of the JSON should be the participant names, and the values should be their calendar details."
),
expected_output=(
"A JSON string containing all participant calendar data: timezone, working hours, and busy slots, e.g. "
'{"Alice": {"timezone": "America/New_York", "working_hours": {"start": "09:00", "end": "17:00"}, "busy_slots": [...]}}'
),
agent=availability_checker
)
task_optimization = Task(
description=(
f"Analyze the compiled participant schedules and calculate the optimal 45-minute meeting window "
f"for the target date {target_date}. Use the Calculate Meeting Window Tool. "
"Pass the compiled schedules JSON into the tool. "
"Print the final schedule showing the localized perspective of each user (e.g. Alice, Bob, Charlie, David, Eve)."
),
expected_output=(
"A comprehensive localized meeting report detailing the selected window in UTC, localized times for Alice, Bob, "
"Charlie, David, and Eve, and a summary explaining any disruptions or compromises."
),
agent=optimization_coordinator
)
return task_timezone, task_availability, task_optimization