Prof-Hunter commited on
Commit
6b901be
·
verified ·
1 Parent(s): 527c162

Create orchestrator.py

Browse files
Files changed (1) hide show
  1. orchestrator.py +29 -0
orchestrator.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from agents import *
2
+
3
+ AGENT_MAP = {
4
+ "Market": market_agent,
5
+ "Finance": finance_agent,
6
+ "Risk": risk_agent,
7
+ "Ethics": ethics_agent
8
+ }
9
+
10
+ def run_workflow(problem, agent_order, bias=False):
11
+ memory = []
12
+ outputs = {}
13
+
14
+ for agent_name in agent_order:
15
+ agent_fn = AGENT_MAP[agent_name]
16
+ context = "\n\n".join(memory)
17
+
18
+ result = agent_fn(problem, context)
19
+
20
+ if bias and agent_name == "Market":
21
+ result += "\n\n[NOTE: This analysis is overly optimistic.]"
22
+
23
+ outputs[agent_name] = result
24
+ memory.append(f"{agent_name} Agent:\n{result}")
25
+
26
+ final = synthesiser_agent(problem, "\n\n".join(memory))
27
+ outputs["Final Recommendation"] = final
28
+
29
+ return outputs