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 |
|---|---|---|
currentRequestId | String | 当前请求标识(类型 `String`)。The current request id. |
agent | A2aAgent | 智能体(类型 `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.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:64–66getAgent
public A2aAgent getAgent()
获取智能体。
Returns the agent.
A2aAgent返回A2aAgent。Returns a 2 a agent.
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:68–70getSink
public MonoSink<Msg> getSink()
获取 getSink。
Returns the sink.
MonoSink<Msg>返回MonoSink。Returns mono sink.
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:72–74setSink
public void setSink(MonoSink<Msg> sink)
设置 setSink。
Sets the sink.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sink | MonoSink<Msg> | sink(类型 `MonoSink`)。The sink. |
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:76–78getHooks
public List<Hook> getHooks()
获取 getHooks。
Returns the hooks.
List<Hook>返回列出。Returns list.
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:80–82setHooks
public void setHooks(List<Hook> hooks)
设置 setHooks。
Sets the hooks.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
hooks | List<Hook> | hooks(类型 `List`)。The hooks. |
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:84–86getTask
public Task getTask()
获取任务。
Returns the task.
Task返回任务。Returns task.
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:88–90setTask
public void setTask(Task task)
设置任务。
Sets the task.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
task | Task | 任务(类型 `Task`)。The task. |
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:92–94setInputMessages
public void setInputMessages(List<Msg> inputMessages)
设置输入消息。
Sets the input messages.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
inputMessages | List<Msg> | 输入消息(类型 `List`)。The input messages. |
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:96–98isTerminalDelivered
public boolean isTerminalDelivered()
判断是否 isTerminalDelivered。
Returns whether the terminal delivered.
boolean返回布尔值,表示判断结果。Returns a boolean result.
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:100–102complete
public boolean complete(Msg msg)
设置该参数。
Performs the complete operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
boolean返回布尔值,表示判断结果。Returns a boolean result.
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:104–110completeExceptionally
public void completeExceptionally(Throwable error)
设置该参数。
Performs the complete exceptionally operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
error | Throwable | 错误(类型 `Throwable`)。The error. |
源码Source
io/agentscope/core/a2a/agent/event/ClientEventContext.java:112–117