RunOptions 或 ContinueOptions 中设置 OnEvent,即可接收结构化生命周期事件,同时避免应用与模型传输层耦合。
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
实时观察 Go Agent 的运行、模型轮次、工具、暂停和完成事件。
RunOptions 或 ContinueOptions 中设置 OnEvent,即可接收结构化生命周期事件,同时避免应用与模型传输层耦合。
result, err := agent.Run(ctx, phaseoagent.RunOptions{
Input: prompt,
Client: client,
OnEvent: func(event phaseoagent.AgentEvent) {
logger.Info("agent event",
"type", event.Type,
"run_id", event.RunID,
"details", event.Details,
)
},
})