Spaces:
Sleeping
Sleeping
File size: 1,088 Bytes
6b901be 2d30dfd 6b901be 2d30dfd 6b901be 2d30dfd 6b901be 2d30dfd 6b901be 2d30dfd 6b901be 2d30dfd 6b901be 2d30dfd 6b901be 2d30dfd 6b901be |
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 |
from agents import *
from prompts import *
AGENTS = {
"Market": (market_agent, MARKET_PROMPT),
"Finance": (finance_agent, FINANCE_PROMPT),
"Risk": (risk_agent, RISK_PROMPT),
"Ethics": (ethics_agent, ETHICS_PROMPT)
}
def parse_order(order_text):
order = [
x.strip().title()
for x in order_text.split(",")
if x.strip()
]
return order
def run_workflow(problem, order_text, bias=False):
order = parse_order(order_text)
memory = []
outputs = {}
for name in order:
if name not in AGENTS:
continue
fn, prompt = AGENTS[name]
context = "\n\n".join(memory)
result = fn(problem, context, prompt)
# Inject bias
if bias and name == "Market":
result += "\n\n⚠️ WARNING: Over-optimistic bias detected."
outputs[name] = result
memory.append(f"{name} Agent:\n{result}")
final = synthesis_agent(
problem,
"\n\n".join(memory),
SYNTHESIS_PROMPT
)
outputs["Final"] = final
return outputs
|