AS AgentScopeAPI 手册 / API Reference

AgentProtocolTransport

public final class AgentProtocolTransport implements RemoteSubagentTransport
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:28–102

智能体协议传输层,支持智能体之间的发现、委派与协作。位于 io.agentscope.harness.agent.subagent.task 包,实现 RemoteSubagentTransport。核心成员包括 transportType、submit、getStatus、waitForResult、cancel、resume。

RemoteSubagentTransport backed by the Agent Protocol HTTP client.

字段摘要Field Summary

字段Field类型Type说明Description
TYPE
staticfinal
String
类型字段。
The TYPE field.

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentProtocolTransport()
初始化 `AgentProtocolTransport` 实例。
Creates a new instance.
public AgentProtocolTransport(AgentProtocolTaskClient client)
初始化 `AgentProtocolTransport` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String transportType()
返回传输层类型。
Returns the transport type.
public void submit(RemoteTarget target, String taskId, String agentId, String input, RemoteSubmitContext context) throws Exception
执行提交相关操作。
Performs the submit operation.
public RemoteTaskStatus getStatus(RemoteTarget target, String taskId) throws Exception
获取状态。
Returns the status.
public String waitForResult(RemoteTarget target, String taskId, long timeoutSeconds) throws Exception
等待用于结果。
Performs the wait for result operation.
public void cancel(RemoteTarget target, String taskId) throws Exception
执行取消相关操作。
Performs the cancel operation.
public void resume(RemoteTarget target, String taskId, List<RemoteConfirmDecision> decisions) throws Exception
执行恢复相关操作。
Performs the resume operation.
public Closeable streamEvents(RemoteTarget target, String taskId, long fromSeq, Consumer<RemoteAgentEvent> consumer)
执行事件。
Streams the events.

字段详情Field Detail

TYPE

public static final String TYPE
staticfinal

类型字段。声明为 public static final String TYPE。

The TYPE field.

源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:30

构造器详情Constructor Detail

AgentProtocolTransport

public AgentProtocolTransport()

初始化 AgentProtocolTransport 实例。

Creates a new instance.

源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:36–38

AgentProtocolTransport

public AgentProtocolTransport(AgentProtocolTaskClient client)

初始化 AgentProtocolTransport 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
clientAgentProtocolTaskClient客户端(类型 `AgentProtocolTaskClient`)。The client.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:40–42

方法详情Method Detail

transportType

public String transportType()

返回传输层类型。

Returns the transport type.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:44–47

submit

public void submit(RemoteTarget target, String taskId, String agentId, String input, RemoteSubmitContext context) throws Exception

执行提交相关操作。

Performs the submit operation.

参数Parameters
名称Name类型Type说明Description
targetRemoteTarget目标(类型 `RemoteTarget`)。The target.
taskIdString任务标识(类型 `String`)。The task id.
agentIdString智能体标识(类型 `String`)。The agent id.
inputString输入消息(类型 `String`)。The input.
contextRemoteSubmitContext上下文(类型 `RemoteSubmitContext`)。The context.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:49–64

getStatus

public RemoteTaskStatus getStatus(RemoteTarget target, String taskId) throws Exception

获取状态。

Returns the status.

参数Parameters
名称Name类型Type说明Description
targetRemoteTarget目标(类型 `RemoteTarget`)。The target.
taskIdString任务标识(类型 `String`)。The task id.
返回Returns RemoteTaskStatus
返回RemoteTaskStatus。Returns remote task status.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:66–69

waitForResult

public String waitForResult(RemoteTarget target, String taskId, long timeoutSeconds) throws Exception

等待用于结果。

Performs the wait for result operation.

参数Parameters
名称Name类型Type说明Description
targetRemoteTarget目标(类型 `RemoteTarget`)。The target.
taskIdString任务标识(类型 `String`)。The task id.
timeoutSecondslong超时秒(类型 `long`)。The timeout seconds.
返回Returns String
返回字符串结果。Returns a string.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:71–75

cancel

public void cancel(RemoteTarget target, String taskId) throws Exception

执行取消相关操作。

Performs the cancel operation.

参数Parameters
名称Name类型Type说明Description
targetRemoteTarget目标(类型 `RemoteTarget`)。The target.
taskIdString任务标识(类型 `String`)。The task id.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:77–80

resume

public void resume(RemoteTarget target, String taskId, List<RemoteConfirmDecision> decisions) throws Exception

执行恢复相关操作。

Performs the resume operation.

参数Parameters
名称Name类型Type说明Description
targetRemoteTarget目标(类型 `RemoteTarget`)。The target.
taskIdString任务标识(类型 `String`)。The task id.
decisionsList<RemoteConfirmDecision>decisions(类型 `List`)。The decisions.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:82–86

streamEvents

public Closeable streamEvents(RemoteTarget target, String taskId, long fromSeq, Consumer<RemoteAgentEvent> consumer)

执行事件。

Streams the events.

参数Parameters
名称Name类型Type说明Description
targetRemoteTarget目标(类型 `RemoteTarget`)。The target.
taskIdString任务标识(类型 `String`)。The task id.
fromSeqlong来自 Seq(类型 `long`)。The from seq.
consumerConsumer<RemoteAgentEvent>消费者(类型 `Consumer`)。The consumer.
返回Returns Closeable
返回Closeable。Returns closeable.
源码Source io/agentscope/harness/agent/subagent/task/AgentProtocolTransport.java:88–101
基于官方固定版本源码静态生成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.