@@ -143,11 +143,12 @@ type ReplannerConfig struct {
143143 - 内层 ` LoopAgent ` :循环执行 ` Executor ` 和 ` Replanner ` ,直至任务完成或达到最大迭代次数
144144
145145``` go
146- // NewPlanExecuteAgent creates a new plan execute agent with the given configuration.
147- func NewPlanExecuteAgent (ctx context .Context , cfg *PlanExecuteConfig ) (adk .Agent , error )
146+ // github.com/cloudwego/eino/adk/prebuilt/planexecute
147+ // New creates a new plan execute agent with the given configuration.
148+ func New (ctx context .Context , cfg *PlanExecuteConfig ) (adk .Agent , error )
148149
149- // PlanExecuteConfig provides configuration options for creating a plan execute agent.
150- type PlanExecuteConfig struct {
150+ // Config provides configuration options for creating a plan execute agent.
151+ type Config struct {
151152 Planner adk.Agent
152153 Executor adk.Agent
153154 Replanner adk.Agent
@@ -174,8 +175,9 @@ Plan-Execute Agent 的完整工作流程如下:
174175
175176### 场景说明
176177
177- 1 . ** Planner** :为【生成旅游计划】这个目标规划详细步骤
178- 2 . ** Executor** :使用多种工具(天气查询、航班酒店搜索、目的地吸引力)执行计划。允许在用户请求不明确或缺乏执行所需要的信息时,要求用户输入澄清来补充信息(Human in the loop 场景)
178+ 实现一个「调研」Agent:
179+ 1 . ** Planner** :为调研目标规划详细步骤
180+ 2 . ** Executor** :执行计划中的首个步骤,必要时使用搜索工具(duckduckgo)
1791813 . ** Replanner** :评估执行结果,若信息不足则调整计划,否则生成最终总结
180182
181183### 代码实现
@@ -192,7 +194,7 @@ func newToolCallingModel(ctx context.Context) model.ToolCallingChatModel {
192194 if err != nil {
193195 log.Fatalf (" 初始化模型失败: %v " , err)
194196 }
195- return cm.(model. ToolCallingChatModel )
197+ return cm
196198}
197199
198200// 初始化搜索工具(用于 Executor 调用)
@@ -330,7 +332,7 @@ func main() {
330332 }
331333 // 打印智能体输出(计划、执行结果、最终响应等)
332334 if msg , err := event.Output .MessageOutput .GetMessage (); err == nil && msg.Content != " " {
333- log. Printf ( " \n === Agent Output === \n %s \n " , msg. Content )
335+ // code...
334336 }
335337 }
336338}
0 commit comments