-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathdemo.py
More file actions
49 lines (42 loc) · 1.21 KB
/
demo.py
File metadata and controls
49 lines (42 loc) · 1.21 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
39
40
41
42
43
44
45
46
47
48
49
import asyncio
import os
from oxygent import MAS, Config, oxy, preset_tools
Config.set_agent_llm_model("default_llm")
oxy_space = [
oxy.HttpLLM(
name="default_llm",
api_key=os.getenv("DEFAULT_LLM_API_KEY"),
base_url=os.getenv("DEFAULT_LLM_BASE_URL"),
model_name=os.getenv("DEFAULT_LLM_MODEL_NAME"),
),
preset_tools.time_tools,
oxy.ReActAgent(
name="time_agent",
desc="A tool that can query the time",
tools=["time_tools"],
),
preset_tools.file_tools,
oxy.ReActAgent(
name="file_agent",
desc="A tool that can operate the file system",
tools=["file_tools"],
),
preset_tools.math_tools,
oxy.ReActAgent(
name="math_agent",
desc="A tool that can perform mathematical calculations.",
tools=["math_tools"],
),
oxy.ReActAgent(
is_master=True,
name="master_agent",
sub_agents=["time_agent", "file_agent", "math_agent"],
),
]
async def main():
async with MAS(oxy_space=oxy_space) as mas:
await mas.start_web_service(
first_query="What time is it now? Please save it into time.txt."
)
if __name__ == "__main__":
asyncio.run(main())