AS AgentScopeAPI 手册 / API Reference

AgentRunner

public interface AgentRunner
源码Source 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.

返回Returns String
返回字符串结果。agent name
源码Source io/agentscope/core/a2a/server/executor/runner/AgentRunner.java:42

getAgentDescription

public String getAgentDescription()

获取 getAgentDescription。

Get agent description to build AgentCard.

返回Returns String
返回字符串结果。agent description
源码Source io/agentscope/core/a2a/server/executor/runner/AgentRunner.java:49

streamEvents

public Flux<AgentEvent> streamEvents(List<Msg> requestMessages, AgentRequestOptions options)

执行事件。

Start to handle agent request with streaming output.

参数Parameters
名称Name类型Type说明Description
requestMessagesList<Msg>消息来自 A2A 客户端。the messages from a2a client
optionsAgentRequestOptions选项(类型 `AgentRequestOptions`)。the options for agent request, such as `taskId`, `sessionId` or `userId` of this request
返回Returns Flux<AgentEvent>
返回Flux。Flux of events emitted during execution
源码Source io/agentscope/core/a2a/server/executor/runner/AgentRunner.java:58

stop

public void stop(String taskId)

设置停止。

Stop to handle agent request.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。the taskId of request needed to stop
源码Source io/agentscope/core/a2a/server/executor/runner/AgentRunner.java:65
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.