AS AgentScopeAPI 手册 / API Reference

GrpcTransport

public final class GrpcTransport implements AutoCloseable
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:58–441

gRPC 传输层,承载智能体的部署、调度与服务化运行。位于 io.agentscope.extensions.controlplane.transport 包,实现 AutoCloseable。核心成员包括 setSessionCommandHandler、setExecutionAttemptHandler、setConversationTurnHandler、setEventAckHandler、isConnected、updateIdentity。

ASDP upstream channel: a single bidirectional gRPC stream multiplexing every report type, the same shape the Go control plane and the Python SDK use.

Reconnects with capped exponential backoff. The bridge owns the durable event outbox and only advances it after receiving EventReportAck; non-event telemetry remains best effort.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
SessionCommandHandler接口interface
定义会话命令处理器契约的接口。
Receives `SessionCommand` pushed down by the control plane.
ExecutionAttemptCommandHandler接口interface
定义执行尝试命令处理器契约的接口。
Receives a fenced execution-attempt command from the control plane.
ConversationTurnCommandHandler接口interface
定义会话轮次命令处理器契约的接口。
Receives a fenced online conversation turn from the control plane.
EventAckHandler接口interface
定义事件确认处理器契约的接口。
Receives a durable commit acknowledgement for a Level-2 event report.

构造器摘要Constructor Summary

构造器Constructor说明Description
public GrpcTransport(String target, String credential, String agentId, String agentKey, String bindingId, String tenant, String namespace, String instanceKey, long generation, String runtime, String sdkVersion, Collection<String> capabilities, String sessionAffinity)
初始化 `GrpcTransport` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public void setSessionCommandHandler(SessionCommandHandler handler)
设置会话命令处理器。
Sets the session command handler.
public void setExecutionAttemptHandler(ExecutionAttemptCommandHandler handler)
设置执行尝试处理器。
Sets the execution attempt handler.
public void setConversationTurnHandler(ConversationTurnCommandHandler handler)
设置会话轮次处理器。
Sets the conversation turn handler.
public void setEventAckHandler(EventAckHandler handler)
设置事件确认处理器。
Sets the event ack handler.
public boolean isConnected()
判断是否已连接。
Returns whether the connected.
public void updateIdentity(String credential, String agentId, String bindingId, String instanceKey, long generation)
更新身份。
Refreshes the fenced Catalog identity used by the next connection attempt.
public void start()
执行启动相关操作。
Returns the start.
public void reportSessions(List<SessionSnapshot> snapshots)
设置报告会话。
Performs the report sessions operation.
public boolean reportEvents(String reportId, List<SessionEventMsg> events)
执行报告事件相关操作。
Performs the report events operation.
public void reportContext(ContextReport report)
设置报告上下文。
Performs the report context operation.
public void reportInventory(InventoryReport report)
设置报告清单。
Performs the report inventory operation.
public void reportExecutionAttempt(ExecutionAttemptReport report)
设置报告执行尝试。
Performs the report execution attempt operation.
public void reportConversationTurn(ConversationTurnReport report)
设置报告会话轮次。
Performs the report conversation turn operation.
public void close()
关闭连接并释放相关资源。
Releases resources and connections.

构造器详情Constructor Detail

GrpcTransport

public GrpcTransport(String target, String credential, String agentId, String agentKey, String bindingId, String tenant, String namespace, String instanceKey, long generation, String runtime, String sdkVersion, Collection<String> capabilities, String sessionAffinity)

初始化 GrpcTransport 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
targetString目标(类型 `String`)。The target.
credentialString凭证对象(类型 `String`)。The credential.
agentIdString智能体标识(类型 `String`)。The agent id.
agentKeyString智能体键(类型 `String`)。The agent key.
bindingIdString绑定标识(类型 `String`)。The binding id.
tenantString租户(类型 `String`)。The tenant.
namespaceString命名空间(类型 `String`)。The namespace.
instanceKeyString实例键(类型 `String`)。The instance key.
generationlonggeneration(类型 `long`)。The generation.
runtimeString运行时(类型 `String`)。The runtime.
sdkVersionStringsdk 版本(类型 `String`)。The sdk version.
capabilitiesCollection<String>能力(类型 `Collection`)。The capabilities.
sessionAffinityString会话 Affinity(类型 `String`)。The session affinity.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:123–150

方法详情Method Detail

setSessionCommandHandler

public void setSessionCommandHandler(SessionCommandHandler handler)

设置会话命令处理器。

Sets the session command handler.

参数Parameters
名称Name类型Type说明Description
handlerSessionCommandHandler处理器(类型 `SessionCommandHandler`)。The handler.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:152–154

setExecutionAttemptHandler

public void setExecutionAttemptHandler(ExecutionAttemptCommandHandler handler)

设置执行尝试处理器。

Sets the execution attempt handler.

参数Parameters
名称Name类型Type说明Description
handlerExecutionAttemptCommandHandler处理器(类型 `ExecutionAttemptCommandHandler`)。The handler.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:156–158

setConversationTurnHandler

public void setConversationTurnHandler(ConversationTurnCommandHandler handler)

设置会话轮次处理器。

Sets the conversation turn handler.

参数Parameters
名称Name类型Type说明Description
handlerConversationTurnCommandHandler处理器(类型 `ConversationTurnCommandHandler`)。The handler.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:160–162

setEventAckHandler

public void setEventAckHandler(EventAckHandler handler)

设置事件确认处理器。

Sets the event ack handler.

参数Parameters
名称Name类型Type说明Description
handlerEventAckHandler处理器(类型 `EventAckHandler`)。The handler.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:164–166

isConnected

public boolean isConnected()

判断是否已连接。

Returns whether the connected.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:168–170

updateIdentity

public void updateIdentity(String credential, String agentId, String bindingId, String instanceKey, long generation)

更新身份。

Refreshes the fenced Catalog identity used by the next connection attempt.

参数Parameters
名称Name类型Type说明Description
credentialString凭证对象(类型 `String`)。The credential.
agentIdString智能体标识(类型 `String`)。The agent id.
bindingIdString绑定标识(类型 `String`)。The binding id.
instanceKeyString实例键(类型 `String`)。The instance key.
generationlonggeneration(类型 `long`)。The generation.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:178–198

start

public void start()

执行启动相关操作。

Returns the start.

源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:200–211

reportSessions

public void reportSessions(List<SessionSnapshot> snapshots)

设置报告会话。

Performs the report sessions operation.

参数Parameters
名称Name类型Type说明Description
snapshotsList<SessionSnapshot>snapshots(类型 `List`)。The snapshots.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:274–284

reportEvents

public boolean reportEvents(String reportId, List<SessionEventMsg> events)

执行报告事件相关操作。

Performs the report events operation.

参数Parameters
名称Name类型Type说明Description
reportIdString报告标识(类型 `String`)。The report id.
eventsList<SessionEventMsg>事件列表(类型 `List`)。The events.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:286–299

reportContext

public void reportContext(ContextReport report)

设置报告上下文。

Performs the report context operation.

参数Parameters
名称Name类型Type说明Description
reportContextReport报告(类型 `ContextReport`)。The report.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:301–303

reportInventory

public void reportInventory(InventoryReport report)

设置报告清单。

Performs the report inventory operation.

参数Parameters
名称Name类型Type说明Description
reportInventoryReport报告(类型 `InventoryReport`)。The report.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:305–307

reportExecutionAttempt

public void reportExecutionAttempt(ExecutionAttemptReport report)

设置报告执行尝试。

Performs the report execution attempt operation.

参数Parameters
名称Name类型Type说明Description
reportExecutionAttemptReport报告(类型 `ExecutionAttemptReport`)。The report.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:309–311

reportConversationTurn

public void reportConversationTurn(ConversationTurnReport report)

设置报告会话轮次。

Performs the report conversation turn operation.

参数Parameters
名称Name类型Type说明Description
reportConversationTurnReport报告(类型 `ConversationTurnReport`)。The report.
源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:313–315

close

public void close()

关闭连接并释放相关资源。

Releases resources and connections.

源码Source io/agentscope/extensions/controlplane/transport/GrpcTransport.java:349–373

嵌套类详情Nested Class Detail

SessionCommandHandler

@FunctionalInterface public interface SessionCommandHandler

定义会话命令处理器契约的接口。位于 io.agentscope.extensions.controlplane.transport 包。核心成员包括 onCommand。

Receives SessionCommand pushed down by the control plane.

ExecutionAttemptCommandHandler

@FunctionalInterface public interface ExecutionAttemptCommandHandler

定义执行尝试命令处理器契约的接口。位于 io.agentscope.extensions.controlplane.transport 包。核心成员包括 onExecutionAttempt。

Receives a fenced execution-attempt command from the control plane.

ConversationTurnCommandHandler

@FunctionalInterface public interface ConversationTurnCommandHandler

定义会话轮次命令处理器契约的接口。位于 io.agentscope.extensions.controlplane.transport 包。核心成员包括 onConversationTurn。

Receives a fenced online conversation turn from the control plane.

EventAckHandler

@FunctionalInterface public interface EventAckHandler

定义事件确认处理器契约的接口。位于 io.agentscope.extensions.controlplane.transport 包。核心成员包括 onAck。

Receives a durable commit acknowledgement for a Level-2 event report.

基于官方固定版本源码静态生成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.