-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
69 lines (54 loc) · 1.69 KB
/
main.py
File metadata and controls
69 lines (54 loc) · 1.69 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
import os
os.environ["OPENAI_API_KEY"] = "NA"
# Disable CrewAI-specific telemetry
os.environ["CREWAI_DISABLE_TELEMETRY"] = "true"
# Disable the underlying OpenTelemetry SDK (covers all signals)
os.environ["OTEL_SDK_DISABLED"] = "true"
# Some versions may also check for this
os.environ["CREWAI_DISABLE_TRACKING"] = "true"
from crewai import LLM
from llm_setup import get_local_llm
from agents import create_agents
from crewai import Crew, Process
from tasks import get_tasks
def main():
# Initialize local LLM
#llm = get_local_llm()
local_llm = LLM(
model="ollama/phi3:mini",
base_url="http://localhost:11434",
temperature=0,
top_p=0.1
)
# Create agents and tasks
agents = create_agents(local_llm)
tasks = get_tasks(agents)
os.makedirs("output", exist_ok=True)
# Initialize CrewAI workflow (sequential to prevent OOM)
crew = Crew(
agents=agents,
tasks=tasks,
process=Process.sequential,
verbose=True, # prints agent actions
memory=False,
manager_llm=local_llm,
provider_overrides={"openai": None}
)
# Read Spark log from file
log_file_path = "spark_log.txt" # place your Spark log here
try:
with open(log_file_path, "r") as f:
spark_log = f.read()
except FileNotFoundError:
print(f"Error: File {log_file_path} not found.")
return
# Pass log through multi-agent system
inputs = {
'topic': spark_log
}
crew.kickoff()
print("\n✅ Multi-agent workflow complete. Outputs saved in 'output/' directory:")
for task in tasks:
print(f" - {task.output_file}")
if __name__ == "__main__":
main()