-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
40 lines (38 loc) · 1.66 KB
/
tasks.py
File metadata and controls
40 lines (38 loc) · 1.66 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
from crewai import Task
def get_tasks(agents):
"""
Define CrewAI tasks with assigned agents.
agents: list of CrewAI Agent objects
"""
log_agent, classification_agent, remediation_agent = agents
tasks = [
Task(
name="extract_error",
description="You are given a Spark log file. \
ONLY extract the exact error message explicitly present in the log.\
DO NOT infer, assume, or add additional errors.\
Return ONLY the exact error text found in the log.\
If only one error exists, return that single error.",
expected_output="A concise description of the primary error in the log",
agent=log_agent, # assign the agent
input_mapping={"input": "spark_log.txt"},
output_file="output/extracted_error.txt"
),
Task(
name="classify_error",
description="Classify the extracted error type (OOM, timeout, etc.)",
expected_output="The type/category of the Spark error",
agent=classification_agent, # assign the agent
input_mapping={"input": "output/extracted_error.txt"},
output_file="output/classified_error.txt"
),
Task(
name="suggest_remediation",
description="Suggest actionable fixes for the classified Spark error",
expected_output="Step-by-step remediation suggestions",
agent=remediation_agent, # assign the agent
input_mapping={"input": "output/classified_error.txt"},
output_file="output/remediation.txt"
)
]
return tasks