from swarms import Agent, MixtureOfAgents, SqliteChannel
workers = [
Agent(agent_name="Bull", system_prompt="Make the strongest case for the investment.", model_name="gpt-5.4", max_loops=1),
Agent(agent_name="Bear", system_prompt="Make the strongest case against the investment.", model_name="gpt-5.4", max_loops=1),
Agent(agent_name="Quant", system_prompt="Assess the numbers only.", model_name="gpt-5.4", max_loops=1),
]
aggregator = Agent(
agent_name="Portfolio-Manager",
system_prompt="Weigh the analysts' views and give a final recommendation.",
model_name="gpt-5.4",
max_loops=1,
)
channel = SqliteChannel("investments.db", name="nvda-2026-11")
moa = MixtureOfAgents(
agents=workers,
aggregator_agent=aggregator,
layers=2,
channel=channel,
)
print(moa.run("Should we add to our NVIDIA position this quarter?"))
# Only the Bear's arguments, latest last.
for row in channel.fetch_messages():
if row["agent_name"].startswith("Bear"):
print(row["agent_name"], row["content"][:120])