File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -115,3 +115,41 @@ planner_agent = Agent(
115115runner = Runner(agent = planner_agent, short_term_memory = ShortTermMemory())
116116response = await runner.run(messages = prompt, session_id = session_id)
117117```
118+
119+ ## 从 Agent 配置文件构建
120+
121+ 你可以通过一个 Agent 配置文件来构建 Agent 运行时实例,例如:
122+
123+ ``` yaml
124+ root_agent :
125+ type : Agent # Agent | SequencialAgent | LoopAgent | ParallelAgent
126+ name : test
127+ description : A test agent
128+ instruction : A test instruction
129+ long_term_memory :
130+ backend : local
131+ knowledgebase :
132+ backend : opensearch
133+ sub_agents :
134+ - ${sub_agent_1}
135+
136+ sub_agent_1 :
137+ type : Agent
138+ name : agent1
139+ ` ` `
140+
141+ 其中,每个` agent`的`type`负责指定 Agent 的类名。
142+
143+ 可以通过如下代码来实例化这个 Agent :
144+
145+ ` ` ` python
146+ from veadk.agent_builder import AgentBuilder
147+
148+ agent = AgentBuilder().build(path="./agent.yaml")
149+ ` ` `
150+
151+ 函数`build`接收3个参数:
152+
153+ - ` path` :配置文件路径
154+ - ` root_agent_identifier` :配置文件中主 Agent 的名称,默认为`root_agent`
155+ - ` tools` :主 agent 挂载的工具列表(子 Agent 工具列表暂未推出)
Original file line number Diff line number Diff line change 22from google .adk .agents .llm_agent import ToolUnion
33from omegaconf import OmegaConf
44
5+ from veadk .a2a .remote_ve_agent import RemoteVeAgent
56from veadk .agent import Agent
67from veadk .agents .loop_agent import LoopAgent
78from veadk .agents .parallel_agent import ParallelAgent
1516 "SequentialAgent" : SequentialAgent ,
1617 "ParallelAgent" : ParallelAgent ,
1718 "LoopAgent" : LoopAgent ,
19+ "RemoteVeAgent" : RemoteVeAgent ,
1820}
1921
2022
You can’t perform that action at this time.
0 commit comments