Leonydis137 commited on
Commit
fe65c02
·
verified ·
1 Parent(s): b81144b

Update orchestrator.py

Browse files
Files changed (1) hide show
  1. orchestrator.py +7 -23
orchestrator.py CHANGED
@@ -1,35 +1,19 @@
1
  from agents.planner import plan_task
2
  from agents.executor import execute_step
3
  from agents.critic import review_result
4
- from memory import add_to_memory, search_memory
5
- import uuid
6
- from datetime import datetime
7
-
8
- def run_agents(goal, memory, session_id=None):
9
- session_id = session_id or str(uuid.uuid4())[:8]
10
- timestamp = datetime.now().isoformat(timespec="seconds")
11
-
12
- log = f"[{timestamp}] Session {session_id}: Goal: {goal}\n"
13
- history = search_memory(goal, memory)
14
- context = "\n".join(history[:3]) if history else "No relevant memory found."
15
 
 
16
  plan = plan_task(goal, memory)
17
- add_to_memory(f"[{session_id}] 🧠 Context: {context}", memory)
18
- add_to_memory(f"[{session_id}] 🗂 Plan: {plan}", memory)
19
 
20
  outputs = []
21
  for step in plan:
22
  result = execute_step(step)
23
- add_to_memory(f"[{session_id}] 🔧 Executor ran: {step} -> {result}", memory)
24
 
25
  review = review_result(step, result)
26
- add_to_memory(f"[{session_id}] 🔍 Critic: {review}", memory)
27
-
28
- step_log = f"🔹 Step: {step}\n🛠 Result: {result}\n🧠 Review: {review}\n"
29
- log += step_log + "\n"
30
- outputs.append(step_log)
31
-
32
- with open("log.txt", "a") as f:
33
- f.write(log + "\n")
34
 
35
- return "\n".join(outputs)
 
1
  from agents.planner import plan_task
2
  from agents.executor import execute_step
3
  from agents.critic import review_result
4
+ from memory import add_to_memory
 
 
 
 
 
 
 
 
 
 
5
 
6
+ def run_agents(goal, memory):
7
  plan = plan_task(goal, memory)
8
+ add_to_memory(f"Planner: {plan}", memory)
 
9
 
10
  outputs = []
11
  for step in plan:
12
  result = execute_step(step)
13
+ add_to_memory(f"Executor: {step} -> {result}", memory)
14
 
15
  review = review_result(step, result)
16
+ add_to_memory(f"Critic: {review}", memory)
17
+ outputs.append((step, result, review))
 
 
 
 
 
 
18
 
19
+ return outputs