-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
38 lines (32 loc) · 1.25 KB
/
example.py
File metadata and controls
38 lines (32 loc) · 1.25 KB
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
"""
Example of a simple agent team with two agents.
"""
from loguru import logger
from elemental_agents.core.agent.agent_factory import AgentFactory
from elemental_agents.core.agent_team.generic_agent_team import GenericAgentTeam
from elemental_agents.core.selector.agent_selector_factory import AgentSelectorFactory
agent1 = AgentFactory.create(
agent_name="AssistantAgent",
agent_persona="You are a helpful assistant.",
agent_type="ConvPlanReAct",
llm_model="openai|gpt-4.1-mini",
tools=["Calculator", "CurrentTime", "NoAction"],
)
agent2 = AgentFactory.create(
agent_name="ProgrammerAgent",
agent_persona="You are a helpful programmer.",
agent_type="ConvPlanReAct",
llm_model="openai|gpt-4.1-mini",
tools=["Calculator", "CurrentTime", "NoAction"],
)
selector_factory = AgentSelectorFactory()
agent_selector = selector_factory.create(
selector_name="conversational", lead_agent="AssistantAgent"
)
agent_team = GenericAgentTeam(selector=agent_selector)
agent_team.register_agent("AssistantAgent", agent1, "ConvPlanReAct")
agent_team.register_agent("ProgrammerAgent", agent2, "ConvPlanReAct")
result = agent_team.run(
task="What is the color of sky on Mars?", input_session="Example Session"
)
logger.info(f"Result: {result}")