AguiStreamContext
public class AguiStreamContext
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:39–456AGUI 流上下文,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.agui.adapter.strategy 包。核心成员包括 getThreadId、getRunId、getConfig、getRunInput、beginEvent、drainEvents。
A class in io.agentscope.core.agui.adapter.strategy that carries structured messages and events between agents, models and UIs. Declared in io.agentscope.core.agui.adapter.strategy.
构造器摘要Constructor Summary
方法摘要Method Summary
构造器详情Constructor Detail
AguiStreamContext
public AguiStreamContext(String threadId, String runId, AguiAdapterConfig config)
初始化 AguiStreamContext 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
runId | String | 运行标识(类型 `String`)。The run id. |
config | AguiAdapterConfig | 配置对象(类型 `AguiAdapterConfig`)。The config. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:66–68AguiStreamContext
public AguiStreamContext(String threadId, String runId, AguiAdapterConfig config, RunAgentInput runInput)
初始化 AguiStreamContext 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
runId | String | 运行标识(类型 `String`)。The run id. |
config | AguiAdapterConfig | 配置对象(类型 `AguiAdapterConfig`)。The config. |
runInput | RunAgentInput | 运行输入(类型 `RunAgentInput`)。The run input. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:70–73AguiStreamContext
public AguiStreamContext(String threadId, String runId, AguiAdapterConfig config, RunAgentInput runInput, Predicate<String> isExternalTool)
初始化 AguiStreamContext 实例。
Stream conversion context.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
runId | String | 运行标识(类型 `String`)。The run id. |
config | AguiAdapterConfig | 配置对象(类型 `AguiAdapterConfig`)。The config. |
runInput | RunAgentInput | 运行输入(类型 `RunAgentInput`)。The run input. |
isExternalTool | Predicate<String> | 是外部工具(类型 `Predicate`)。predicate for external-tool resolution by tool name |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:86–98方法详情Method Detail
getThreadId
public String getThreadId()
获取会话线程标识。
Returns the thread id.
Stringio/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:100–102getRunId
public String getRunId()
获取运行标识。
Returns the run id.
Stringio/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:104–106getConfig
public AguiAdapterConfig getConfig()
获取配置。
Returns the config.
AguiAdapterConfigio/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:108–110getRunInput
public RunAgentInput getRunInput()
获取运行输入。
Returns the run input.
RunAgentInputio/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:112–114beginEvent
public void beginEvent()
执行 beginEvent 方法。
Returns the begin event.
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:116–118drainEvents
public List<AguiEvent> drainEvents()
返回 drainEvents 结果。
Returns the drain events.
List<AguiEvent>io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:120–124emit
public void emit(AguiEvent event)
设置发出。
Performs the emit operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
event | AguiEvent | 事件(类型 `AguiEvent`)。The event. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:126–128startTextMessage
public void startTextMessage(String messageId)
启动文本消息。
Starts the text message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messageId | String | 消息标识(类型 `String`)。The message id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:134–139appendTextDelta
public void appendTextDelta(String messageId, String delta)
追加文本增量。
Performs the append text delta operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messageId | String | 消息标识(类型 `String`)。The message id. |
delta | String | 增量(类型 `String`)。The delta. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:141–146closeActiveTextMessage
public void closeActiveTextMessage()
关闭 closeActiveTextMessage。
Closes the active text message.
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:148–153closeTextMessage
public void closeTextMessage(String messageId)
关闭文本消息。
Closes the text message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messageId | String | 消息标识(类型 `String`)。The message id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:155–166startReasoningMessage
public void startReasoningMessage(String messageId)
启动推理消息。
Starts the reasoning message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messageId | String | 消息标识(类型 `String`)。The message id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:168–173appendReasoningDelta
public void appendReasoningDelta(String messageId, String delta)
追加推理增量。
Performs the append reasoning delta operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messageId | String | 消息标识(类型 `String`)。The message id. |
delta | String | 增量(类型 `String`)。The delta. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:175–180closeActiveReasoningMessage
public void closeActiveReasoningMessage()
关闭 closeActiveReasoningMessage。
Closes the active reasoning message.
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:182–187closeReasoningMessage
public void closeReasoningMessage(String messageId)
关闭推理消息。
Closes the reasoning message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messageId | String | 消息标识(类型 `String`)。The message id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:189–200startToolCall
public void startToolCall(String toolCallId, String toolCallName)
启动工具调用。
Starts the tool call.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
toolCallName | String | 工具调用名称(类型 `String`)。The tool call name. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:202–215appendToolCallArgs
public void appendToolCallArgs(String toolCallId, String delta)
追加工具调用参数。
Performs the append tool call args operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
delta | String | 增量(类型 `String`)。The delta. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:217–224endToolCall
public void endToolCall(String toolCallId)
设置结束工具调用。
Performs the end tool call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:226–234adoptToolCall
public void adoptToolCall(String toolCallId)
设置该参数。
Accept results for a tool call whose invocation was emitted in a previous run.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。stable id of the previously emitted tool call |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:246–252beginToolResult
public void beginToolResult(String toolCallId)
设置该参数。
Performs the begin tool result operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:254–259appendToolResultText
public void appendToolResultText(String toolCallId, String delta)
追加工具结果文本。
Performs the append tool result text operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
delta | String | 增量(类型 `String`)。The delta. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:261–268appendToolResultData
public void appendToolResultData(String toolCallId, ContentBlock data)
追加工具结果数据。
Performs the append tool result data operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
data | ContentBlock | 数据(类型 `ContentBlock`)。The data. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:270–282endToolResult
public void endToolResult(String replyId, String toolCallId)
执行结束工具结果相关操作。
Performs the end tool result operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
replyId | String | 回复标识(类型 `String`)。The reply id. |
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:284–300markToolCallSuspended
public void markToolCallSuspended(String toolCallId)
设置该参数。
Performs the mark tool call suspended operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:302–307addInterrupt
public void addInterrupt(AguiEvent.Interrupt interrupt)
添加中断。
Adds the interrupt.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
interrupt | AguiEvent.Interrupt | 中断(类型 `AguiEvent.Interrupt`)。The interrupt. |
io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:309–312getPendingInterrupts
public List<AguiEvent.Interrupt> getPendingInterrupts()
获取 getPendingInterrupts。
Returns the pending interrupts.
List<AguiEvent.Interrupt>io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:314–316finishPendingEvents
public List<AguiEvent> finishPendingEvents()
返回 finishPendingEvents 结果。
Returns the finish pending events.
List<AguiEvent>io/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:318–328isExternalToolCall
public boolean isExternalToolCall(String toolCallId)
判断是否外部工具调用。
Whether the started tool call resolves to an external tool.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
booleanio/agentscope/core/agui/adapter/strategy/AguiStreamContext.java:384–387