Skip to content

Commit a9cce3e

Browse files
committed
add docs
1 parent d1cd804 commit a9cce3e

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

docs/docs/agent.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,41 @@ planner_agent = Agent(
115115
runner = Runner(agent=planner_agent, short_term_memory=ShortTermMemory())
116116
response = 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 工具列表暂未推出)

veadk/agent_builder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from google.adk.agents.llm_agent import ToolUnion
33
from omegaconf import OmegaConf
44

5+
from veadk.a2a.remote_ve_agent import RemoteVeAgent
56
from veadk.agent import Agent
67
from veadk.agents.loop_agent import LoopAgent
78
from veadk.agents.parallel_agent import ParallelAgent
@@ -15,6 +16,7 @@
1516
"SequentialAgent": SequentialAgent,
1617
"ParallelAgent": ParallelAgent,
1718
"LoopAgent": LoopAgent,
19+
"RemoteVeAgent": RemoteVeAgent,
1820
}
1921

2022

0 commit comments

Comments
 (0)