AS AgentScopeAPI 手册 / API Reference

ClientEventContext

public class ClientEventContext
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:36–182

用于处理器io.a2a.client.ClientEvent的上下文。位于 io.agentscope.core.a2a.agent.event 包。核心成员包括 getCurrentRequestId、getAgent、getSink、setSink、getHooks、setHooks。

Context for handler io.a2a.client.ClientEvent.

One A2A task might respond multiple times, so we need a context to store the response.

构造器摘要Constructor Summary

构造器Constructor说明Description
public ClientEventContext(String currentRequestId, A2aAgent agent)
初始化 `ClientEventContext` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String getCurrentRequestId()
获取当前请求标识。
Returns the current request id.
public A2aAgent getAgent()
获取智能体。
Returns the agent.
public MonoSink<Msg> getSink()
获取 `getSink`。
Returns the sink.
public void setSink(MonoSink<Msg> sink)
设置 `setSink`。
Sets the sink.
public List<Hook> getHooks()
获取 `getHooks`。
Returns the hooks.
public void setHooks(List<Hook> hooks)
设置 `setHooks`。
Sets the hooks.
public Task getTask()
获取任务。
Returns the task.
public void setTask(Task task)
设置任务。
Sets the task.
public void setInputMessages(List<Msg> inputMessages)
设置输入消息。
Sets the input messages.
public boolean isTerminalDelivered()
判断是否 `isTerminalDelivered`。
Returns whether the terminal delivered.
public boolean complete(Msg msg)
设置该参数。
Performs the complete operation.
public void completeExceptionally(Throwable error)
设置该参数。
Performs the complete exceptionally operation.

构造器详情Constructor Detail

ClientEventContext

public ClientEventContext(String currentRequestId, A2aAgent agent)

初始化 ClientEventContext 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
currentRequestIdString当前请求标识(类型 `String`)。The current request id.
agentA2aAgent智能体(类型 `A2aAgent`)。The agent.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:59–62

方法详情Method Detail

getCurrentRequestId

public String getCurrentRequestId()

获取当前请求标识。

Returns the current request id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:64–66

getAgent

public A2aAgent getAgent()

获取智能体。

Returns the agent.

返回Returns A2aAgent
返回A2aAgent。Returns a 2 a agent.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:68–70

getSink

public MonoSink<Msg> getSink()

获取 getSink。

Returns the sink.

返回Returns MonoSink<Msg>
返回MonoSink。Returns mono sink.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:72–74

setSink

public void setSink(MonoSink<Msg> sink)

设置 setSink。

Sets the sink.

参数Parameters
名称Name类型Type说明Description
sinkMonoSink<Msg>sink(类型 `MonoSink`)。The sink.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:76–78

getHooks

public List<Hook> getHooks()

获取 getHooks。

Returns the hooks.

返回Returns List<Hook>
返回列出。Returns list.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:80–82

setHooks

public void setHooks(List<Hook> hooks)

设置 setHooks。

Sets the hooks.

参数Parameters
名称Name类型Type说明Description
hooksList<Hook>hooks(类型 `List`)。The hooks.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:84–86

getTask

public Task getTask()

获取任务。

Returns the task.

返回Returns Task
返回任务。Returns task.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:88–90

setTask

public void setTask(Task task)

设置任务。

Sets the task.

参数Parameters
名称Name类型Type说明Description
taskTask任务(类型 `Task`)。The task.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:92–94

setInputMessages

public void setInputMessages(List<Msg> inputMessages)

设置输入消息。

Sets the input messages.

参数Parameters
名称Name类型Type说明Description
inputMessagesList<Msg>输入消息(类型 `List`)。The input messages.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:96–98

isTerminalDelivered

public boolean isTerminalDelivered()

判断是否 isTerminalDelivered。

Returns whether the terminal delivered.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:100–102

complete

public boolean complete(Msg msg)

设置该参数。

Performs the complete operation.

参数Parameters
名称Name类型Type说明Description
msgMsg消息(类型 `Msg`)。The msg.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:104–110

completeExceptionally

public void completeExceptionally(Throwable error)

设置该参数。

Performs the complete exceptionally operation.

参数Parameters
名称Name类型Type说明Description
errorThrowable错误(类型 `Throwable`)。The error.
源码Source io/agentscope/core/a2a/agent/event/ClientEventContext.java:112–117
基于官方固定版本源码静态生成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.