pull/824/head
parent
0fa4674330
commit
fce26aed2d
@ -1,45 +1,17 @@
|
|||||||
from swarms import Agent, Edge, GraphWorkflow, Node, NodeType
|
from swarms.structs.agent import Agent
|
||||||
from swarms.prompts.finance_agent_sys_prompt import (
|
from swarms.prompts.finance_agent_sys_prompt import (
|
||||||
FINANCIAL_AGENT_SYS_PROMPT,
|
FINANCIAL_AGENT_SYS_PROMPT,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initialize agents with model_name parameter
|
# Initialize the agent
|
||||||
agent1 = Agent(
|
agent = Agent(
|
||||||
agent_name="Agent1",
|
agent_name="Financial-Analysis-Agent",
|
||||||
model_name="openai/gpt-4o-mini", # Using provider prefix
|
agent_description="Personal finance advisor agent",
|
||||||
temperature=0.5,
|
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
|
||||||
max_tokens=4000,
|
max_loops=2,
|
||||||
max_loops=1,
|
model_name="gpt-4o-mini",
|
||||||
autosave=True,
|
dynamic_temperature_enabled=True,
|
||||||
dashboard=True,
|
interactive=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
agent2 = Agent(
|
agent.run("Conduct an analysis of the best real undervalued ETFs")
|
||||||
agent_name="Agent2",
|
|
||||||
model_name="openai/gpt-4o-mini", # Using provider prefix
|
|
||||||
temperature=0.5,
|
|
||||||
max_tokens=4000,
|
|
||||||
max_loops=1,
|
|
||||||
autosave=True,
|
|
||||||
dashboard=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
def sample_task():
|
|
||||||
print("Running sample task")
|
|
||||||
return "Task completed"
|
|
||||||
|
|
||||||
wf_graph = GraphWorkflow()
|
|
||||||
wf_graph.add_node(Node(id="agent1", type=NodeType.AGENT, agent=agent1))
|
|
||||||
wf_graph.add_node(Node(id="agent2", type=NodeType.AGENT, agent=agent2))
|
|
||||||
wf_graph.add_node(Node(id="task1", type=NodeType.TASK, callable=sample_task))
|
|
||||||
|
|
||||||
wf_graph.add_edge(Edge(source="agent1", target="task1"))
|
|
||||||
wf_graph.add_edge(Edge(source="agent2", target="task1"))
|
|
||||||
|
|
||||||
wf_graph.set_entry_points(["agent1", "agent2"])
|
|
||||||
wf_graph.set_end_points(["task1"])
|
|
||||||
|
|
||||||
print(wf_graph.visualize())
|
|
||||||
|
|
||||||
results = wf_graph.run()
|
|
||||||
print("Execution results:", results)
|
|
Loading…
Reference in new issue