AgentRunner
public interface AgentRunner
io/agentscope/core/a2a/server/executor/runner/AgentRunner.java:35–66定义智能体运行器契约的接口。位于 io.agentscope.core.a2a.server.executor.runner 包。核心成员包括 getAgentName、getAgentDescription、streamEvents、stop。
Interface for running agents in A2A Server.
This interface defines the core contract for running agents in the A2A Server. It provides methods for starting, stopping, and get messages from agents.
This interface is designed for extending actual handling logics for io.agentscope.core.agent.Agent,
methods will use Msg as input and use AgentEvent as output.
Developers can do some pre-processing before call io.agentscope.core.agent.Agent or post-processing after
calling io.agentscope.core.agent.Agent.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getAgentName() | 获取智能体名称到构建 AgentCard。 Get agent name to build AgentCard. |
public String getAgentDescription() | 获取 `getAgentDescription`。 Get agent description to build AgentCard. |
public Flux<AgentEvent> streamEvents(List<Msg> requestMessages, AgentRequestOptions options) | 执行事件。 Start to handle agent request with streaming output. |
public void stop(String taskId) | 设置停止。 Stop to handle agent request. |
方法详情Method Detail
getAgentName
public String getAgentName()
获取智能体名称到构建 AgentCard。
Get agent name to build AgentCard.
Stringio/agentscope/core/a2a/server/executor/runner/AgentRunner.java:42getAgentDescription
public String getAgentDescription()
获取 getAgentDescription。
Get agent description to build AgentCard.
Stringio/agentscope/core/a2a/server/executor/runner/AgentRunner.java:49streamEvents
public Flux<AgentEvent> streamEvents(List<Msg> requestMessages, AgentRequestOptions options)
执行事件。
Start to handle agent request with streaming output.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
requestMessages | List<Msg> | 消息来自 A2A 客户端。the messages from a2a client |
options | AgentRequestOptions | 选项(类型 `AgentRequestOptions`)。the options for agent request, such as `taskId`, `sessionId` or `userId` of this request |
Flux<AgentEvent>io/agentscope/core/a2a/server/executor/runner/AgentRunner.java:58stop
public void stop(String taskId)
设置停止。
Stop to handle agent request.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。the taskId of request needed to stop |
io/agentscope/core/a2a/server/executor/runner/AgentRunner.java:65