AguiEvent
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonSubTypes({ @JsonSubTypes.Type(value = AguiEvent.RunStarted.class, name = "RUN_STARTED"), @JsonSubTypes.Type(value = AguiEvent.RunFinished.class, name = "RUN_FINISHED"), @JsonSubTypes.Type(value = AguiEvent.TextMessageStart.class, name = "TEXT_MESSAGE_START"), @JsonSubTypes.Type(value = AguiEvent.TextMessageContent.class, name = "TEXT_MESSAGE_CONTENT"), @JsonSubTypes.Type(value = AguiEvent.TextMessageEnd.class, name = "TEXT_MESSAGE_END"), @JsonSubTypes.Type(value = AguiEvent.ToolCallStart.class, name = "TOOL_CALL_START"), @JsonSubTypes.Type(value = AguiEvent.ToolCallArgs.class, name = "TOOL_CALL_ARGS"), @JsonSubTypes.Type(value = AguiEvent.ToolCallEnd.class, name = "TOOL_CALL_END"), @JsonSubTypes.Type(value = AguiEvent.ToolCallResult.class, name = "TOOL_CALL_RESULT"), @JsonSubTypes.Type(value = AguiEvent.StateSnapshot.class, name = "STATE_SNAPSHOT"), @JsonSubTypes.Type(value = AguiEvent.StateDelta.class, name = "STATE_DELTA"), @JsonSubTypes.Type(value = AguiEvent.Raw.class, name = "RAW"), @JsonSubTypes.Type(value = AguiEvent.Custom.class, name = "CUSTOM"), @JsonSubTypes.Type(value = AguiEvent.ReasoningStart.class, name = "REASONING_START"), @JsonSubTypes.Type( value = AguiEvent.ReasoningMessageStart.class, name = "REASONING_MESSAGE_START"), @JsonSubTypes.Type( value = AguiEvent.ReasoningMessageContent.class, name = "REASONING_MESSAGE_CONTENT"), @JsonSubTypes.Type(value = AguiEvent.ReasoningMessageEnd.class, name = "REASONING_MESSAGE_END"), @JsonSubTypes.Type( value = AguiEvent.ReasoningMessageChunk.class, name = "REASONING_MESSAGE_CHUNK"), @JsonSubTypes.Type(value = AguiEvent.ReasoningEnd.class, name = "REASONING_END"), @JsonSubTypes.Type(value = AguiEvent.RunError.class, name = "RUN_ERROR"), @JsonSubTypes.Type(value = AguiEvent.StepStarted.class, name = "STEP_STARTED"), @JsonSubTypes.Type(value = AguiEvent.StepFinished.class, name = "STEP_FINISHED"), @JsonSubTypes.Type(value = AguiEvent.TextMessageChunk.class, name = "TEXT_MESSAGE_CHUNK"), @JsonSubTypes.Type(value = AguiEvent.ToolCallChunk.class, name = "TOOL_CALL_CHUNK"), @JsonSubTypes.Type(value = AguiEvent.MessagesSnapshot.class, name = "MESSAGES_SNAPSHOT"), @JsonSubTypes.Type(value = AguiEvent.ActivitySnapshot.class, name = "ACTIVITY_SNAPSHOT"), @JsonSubTypes.Type(value = AguiEvent.ActivityDelta.class, name = "ACTIVITY_DELTA"), @JsonSubTypes.Type( value = AguiEvent.ReasoningEncryptedValue.class, name = "REASONING_ENCRYPTED_VALUE") }) public sealed interface AguiEvent permits AguiEvent.RunStarted, AguiEvent.RunFinished, AguiEvent.RunError, AguiEvent.StepStarted, AguiEvent.StepFinished, AguiEvent.TextMessageStart, AguiEvent.TextMessageContent, AguiEvent.TextMessageEnd, AguiEvent.TextMessageChunk, AguiEvent.ToolCallStart, AguiEvent.ToolCallArgs, AguiEvent.ToolCallEnd, AguiEvent.ToolCallChunk, AguiEvent.ToolCallResult, AguiEvent.StateSnapshot, AguiEvent.StateDelta, AguiEvent.MessagesSnapshot, AguiEvent.ActivitySnapshot, AguiEvent.ActivityDelta, AguiEvent.Raw, AguiEvent.Custom, AguiEvent.ReasoningStart, AguiEvent.ReasoningMessageStart, AguiEvent.ReasoningMessageContent, AguiEvent.ReasoningMessageEnd, AguiEvent.ReasoningMessageChunk, AguiEvent.ReasoningEnd, AguiEvent.ReasoningEncryptedValue
io/agentscope/core/agui/event/AguiEvent.java:43–1748定义 AGUI 事件契约的接口。位于 io.agentscope.core.agui.event 包。核心成员包括 getType、getThreadId、getRunId、timestamp、rawEvent。
Sealed interface for all AG-UI protocol events.
All events in the AG-UI protocol implement this interface and provide common properties like event type, thread ID, and run ID. Using sealed interface with records provides a cleaner, more concise implementation.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
RunStarted | 记录record | 承载运行已启动数据的记录类型。 Event indicating that an agent run has started. |
RunFinished | 记录record | 承载运行 Finished数据的记录类型。 Event indicating that an agent run has finished. |
TextMessageStart | 记录record | 承载文本消息启动数据的记录类型。 Event indicating the start of a text message. |
TextMessageContent | 记录record | 承载文本消息内容数据的记录类型。 Event containing incremental text content for a message. |
TextMessageEnd | 记录record | 承载文本消息结束数据的记录类型。 Event indicating the end of a text message. |
ToolCallStart | 记录record | 承载工具调用启动数据的记录类型。 Event indicating the start of a tool call. |
ToolCallArgs | 记录record | 承载工具调用参数数据的记录类型。 Event containing streaming arguments for a tool call. |
ToolCallEnd | 记录record | 承载工具调用结束数据的记录类型。 Event indicating the end of a tool call. |
ToolCallResult | 记录record | 承载工具调用结果数据的记录类型。 Event containing the result of a tool call. |
StateSnapshot | 记录record | 承载状态快照数据的记录类型。 Event containing a full state snapshot. |
StateDelta | 记录record | 承载状态增量数据的记录类型。 Event containing an incremental state delta. |
Raw | 记录record | 承载原始数据的记录类型。 Event containing raw/custom data. |
Custom | 记录record | 承载自定义数据的记录类型。 The Custom event provides an extension mechanism for implementing
features not covered by the standard event types. |
ReasoningStart | 记录record | 承载推理启动数据的记录类型。 Event indicating the start of a reasoning/thinking phase. |
ReasoningMessageStart | 记录record | 承载推理消息启动数据的记录类型。 Event signaling the start of a reasoning message. |
ReasoningMessageContent | 记录record | 承载推理消息内容数据的记录类型。 Event containing a chunk of content in a streaming reasoning message. |
ReasoningMessageEnd | 记录record | 承载推理消息结束数据的记录类型。 Event signaling the end of a reasoning message. |
ReasoningMessageChunk | 记录record | 承载推理消息分块数据的记录类型。 A convenience event to auto start/close reasoning messages. |
ReasoningEnd | 记录record | 承载推理结束数据的记录类型。 Event indicating the end of a reasoning/thinking phase. |
RunError | 记录record | 承载运行错误数据的记录类型。 Event indicating that an agent run has errored. |
StepStarted | 记录record | 承载步骤已启动数据的记录类型。 Event emitted when an agent step begins execution. |
StepFinished | 记录record | 承载步骤 Finished数据的记录类型。 Event emitted when an agent step completes execution. |
TextMessageChunk | 记录record | 承载文本消息分块数据的记录类型。 A convenience event to auto start/close text messages (compatibility chunk mode). |
ToolCallChunk | 记录record | 承载工具调用分块数据的记录类型。 A convenience event to auto start/close tool calls (compatibility chunk mode). |
MessagesSnapshot | 记录record | 承载消息快照数据的记录类型。 Event containing a full snapshot of the conversation messages. |
ActivitySnapshot | 记录record | 承载 Activity 快照数据的记录类型。 Event containing a snapshot of activity state. |
ActivityDelta | 记录record | 承载 Activity 增量数据的记录类型。 Event containing an incremental delta update to activity state. |
ReasoningEncryptedValue | 记录record | 承载推理已加密值数据的记录类型。 Event containing an encrypted reasoning value. |
RunFinishedOutcome | 接口interface | 定义运行 Finished Outcome契约的接口。 Outcome of a finished run. |
RunFinishedSuccessOutcome | 记录record | 承载运行 Finished 成功 Outcome数据的记录类型。 Successful run outcome. |
RunFinishedInterruptOutcome | 记录record | 承载运行 Finished 中断 Outcome数据的记录类型。 Run outcome indicating the run was interrupted, with one or more
interrupts awaiting user resolution. |
Interrupt | 记录record | 承载中断数据的记录类型。 Represents an interrupt that occurred during agent execution, requiring
user input to resolve before the agent can continue. |
JsonPatchOperation | 记录record | 承载 JSON Patch Operation数据的记录类型。 Represents a JSON Patch operation (RFC 6902). |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public AguiEventType getType() | 获取事件类型。 Get the event type. |
public String getThreadId() | 获取会话线程标识。 Get the thread ID associated with this event. |
public String getRunId() | 获取运行标识。 Get the run ID associated with this event. |
public Long timestamp() | 返回时间戳。 Get the optional timestamp indicating when the event was created. |
public Object rawEvent() | 返回原始事件。 Get the optional field containing the original event data if transformed. |
方法详情Method Detail
getType
public AguiEventType getType()
获取事件类型。
Get the event type.
AguiEventTypeio/agentscope/core/agui/event/AguiEvent.java:118–119getThreadId
public String getThreadId()
获取会话线程标识。
Get the thread ID associated with this event.
Stringio/agentscope/core/agui/event/AguiEvent.java:126getRunId
public String getRunId()
获取运行标识。
Get the run ID associated with this event.
Stringio/agentscope/core/agui/event/AguiEvent.java:133timestamp
public Long timestamp()
返回时间戳。
Get the optional timestamp indicating when the event was created.
Longio/agentscope/core/agui/event/AguiEvent.java:140rawEvent
public Object rawEvent()
返回原始事件。
Get the optional field containing the original event data if transformed.
Objectio/agentscope/core/agui/event/AguiEvent.java:147嵌套类详情Nested Class Detail
RunStarted
@JsonInclude(JsonInclude.Include.NON_NULL) record RunStarted( String threadId, String runId, String parentRunId, RunAgentInput input, Long timestamp, Object rawEvent) implements AguiEvent承载运行已启动数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、parentRunId、input、timestamp、rawEvent。
Event indicating that an agent run has started. This is the first event emitted when an agent begins processing a request.
RunFinished
@JsonInclude(JsonInclude.Include.NON_NULL) record RunFinished( String threadId, String runId, Object result, RunFinishedOutcome outcome, Long timestamp, Object rawEvent) implements AguiEvent承载运行 Finished数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、result、outcome、timestamp、rawEvent。
Event indicating that an agent run has finished. This is the last event emitted when an agent completes processing a request.
TextMessageStart
record TextMessageStart( String threadId, String runId, String messageId, String role, Long timestamp, Object rawEvent) implements AguiEvent承载文本消息启动数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、role、timestamp、rawEvent。
Event indicating the start of a text message. This event is emitted when the agent begins generating a text response.
TextMessageContent
record TextMessageContent( String threadId, String runId, String messageId, String delta, Long timestamp, Object rawEvent) implements AguiEvent承载文本消息内容数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、delta、timestamp、rawEvent。
Event containing incremental text content for a message. This event is emitted during streaming to deliver text content in chunks.
TextMessageEnd
record TextMessageEnd( String threadId, String runId, String messageId, Long timestamp, Object rawEvent) implements AguiEvent承载文本消息结束数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、timestamp、rawEvent、getType。
Event indicating the end of a text message. This event is emitted when the agent has finished generating a text message.
ToolCallStart
record ToolCallStart( String threadId, String runId, String toolCallId, String toolCallName, Long timestamp, Object rawEvent) implements AguiEvent承载工具调用启动数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、toolCallId、toolCallName、timestamp、rawEvent。
Event indicating the start of a tool call. This event is emitted when the agent begins a tool invocation.
ToolCallArgs
record ToolCallArgs( String threadId, String runId, String toolCallId, String delta, Long timestamp, Object rawEvent) implements AguiEvent承载工具调用参数数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、toolCallId、delta、timestamp、rawEvent。
Event containing streaming arguments for a tool call. The delta contains a JSON fragment that forms part of the complete tool arguments.
ToolCallEnd
record ToolCallEnd( String threadId, String runId, String toolCallId, Long timestamp, Object rawEvent) implements AguiEvent承载工具调用结束数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、toolCallId、timestamp、rawEvent、getType。
Event indicating the end of a tool call. This event is emitted when a tool invocation completes.
ToolCallResult
record ToolCallResult( String threadId, String runId, String toolCallId, String content, String role, String messageId, Long timestamp, Object rawEvent) implements AguiEvent承载工具调用结果数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、toolCallId、content、role、messageId。
Event containing the result of a tool call.
StateSnapshot
record StateSnapshot( String threadId, String runId, Map<String, Object> snapshot, Long timestamp, Object rawEvent) implements AguiEvent承载状态快照数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、snapshot、timestamp、rawEvent、getType。
Event containing a full state snapshot. This event replaces the entire client-side state with the provided snapshot.
StateDelta
record StateDelta( String threadId, String runId, List<JsonPatchOperation> delta, Long timestamp, Object rawEvent) implements AguiEvent承载状态增量数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、delta、timestamp、rawEvent、getType。
Event containing an incremental state delta. This event contains a list of JSON Patch operations (RFC 6902) that should be applied to the current client-side state.
Raw
record Raw( String threadId, String runId, Object event, String source, Long timestamp, Object rawEvent) implements AguiEvent承载原始数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、event、source、timestamp、rawEvent。
Event containing raw/custom data. This event type allows passing through custom data that doesn't fit into the standard AG-UI event types.
Custom
record Custom( String threadId, String runId, String name, Object value, Long timestamp, Object rawEvent) implements AguiEvent承载自定义数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、name、value、timestamp、rawEvent。
The Custom event provides an extension mechanism for implementing features not covered by the standard event types.
ReasoningStart
record ReasoningStart( String threadId, String runId, String messageId, String encryptedContent, Long timestamp, Object rawEvent) implements AguiEvent承载推理启动数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、encryptedContent、timestamp、rawEvent。
Event indicating the start of a reasoning/thinking phase. This event is emitted when the agent begins its internal reasoning process.
According to AG-UI Reasoning draft specification.
ReasoningMessageStart
record ReasoningMessageStart( String threadId, String runId, String messageId, String role, Long timestamp, Object rawEvent) implements AguiEvent承载推理消息启动数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、role、timestamp、rawEvent。
Event signaling the start of a reasoning message.
According to AG-UI Reasoning draft specification.
ReasoningMessageContent
record ReasoningMessageContent( String threadId, String runId, String messageId, String delta, Long timestamp, Object rawEvent) implements AguiEvent承载推理消息内容数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、delta、timestamp、rawEvent。
Event containing a chunk of content in a streaming reasoning message.
According to AG-UI Reasoning draft specification.
ReasoningMessageEnd
record ReasoningMessageEnd( String threadId, String runId, String messageId, Long timestamp, Object rawEvent) implements AguiEvent承载推理消息结束数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、timestamp、rawEvent、getType。
Event signaling the end of a reasoning message.
According to AG-UI Reasoning draft specification.
ReasoningMessageChunk
record ReasoningMessageChunk( String threadId, String runId, String messageId, String delta, Long timestamp, Object rawEvent) implements AguiEvent承载推理消息分块数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、delta、timestamp、rawEvent。
A convenience event to auto start/close reasoning messages.
According to AG-UI Reasoning draft specification.
ReasoningEnd
record ReasoningEnd( String threadId, String runId, String messageId, Long timestamp, Object rawEvent) implements AguiEvent承载推理结束数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、timestamp、rawEvent、getType。
Event indicating the end of a reasoning/thinking phase. This event is emitted when the agent has finished its internal reasoning process.
According to AG-UI Reasoning draft specification.
RunError
record RunError( String threadId, String runId, String message, String code, Long timestamp, Object rawEvent) implements AguiEvent承载运行错误数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、message、code、timestamp、rawEvent。
Event indicating that an agent run has errored. This event is emitted when the agent encounters an error during execution, replacing the legacy Raw+RunFinished pattern.
StepStarted
record StepStarted( String threadId, String runId, String stepName, Long timestamp, Object rawEvent) implements AguiEvent承载步骤已启动数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、stepName、timestamp、rawEvent、getType。
Event emitted when an agent step begins execution.
StepFinished
record StepFinished( String threadId, String runId, String stepName, Long timestamp, Object rawEvent) implements AguiEvent承载步骤 Finished数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、stepName、timestamp、rawEvent、getType。
Event emitted when an agent step completes execution.
TextMessageChunk
record TextMessageChunk( String threadId, String runId, String messageId, String role, String delta, String name, Long timestamp, Object rawEvent) implements AguiEvent承载文本消息分块数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、role、delta、name。
A convenience event to auto start/close text messages (compatibility chunk mode).
ToolCallChunk
record ToolCallChunk( String threadId, String runId, String toolCallId, String toolCallName, String parentMessageId, String delta, Long timestamp, Object rawEvent) implements AguiEvent承载工具调用分块数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、toolCallId、toolCallName、parentMessageId、delta。
A convenience event to auto start/close tool calls (compatibility chunk mode).
MessagesSnapshot
record MessagesSnapshot( String threadId, String runId, List<AguiMessage> messages, Long timestamp, Object rawEvent) implements AguiEvent承载消息快照数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messages、timestamp、rawEvent、getType。
Event containing a full snapshot of the conversation messages. This event is typically emitted after RUN_FINISHED to synchronize the complete message state.
ActivitySnapshot
record ActivitySnapshot( String threadId, String runId, String messageId, String activityType, Map<String, Object> content, Boolean replace, Long timestamp, Object rawEvent) implements AguiEvent承载 Activity 快照数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、activityType、content、replace。
Event containing a snapshot of activity state. This event provides structured activity data that replaces the entire client-side activity state for the given message.
ActivityDelta
record ActivityDelta( String threadId, String runId, String messageId, String activityType, List<JsonPatchOperation> patch, Long timestamp, Object rawEvent) implements AguiEvent承载 Activity 增量数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、messageId、activityType、patch、timestamp。
Event containing an incremental delta update to activity state. The patch contains a list of JSON Patch operations (RFC 6902) that should be applied to the client-side activity state for the given message.
ReasoningEncryptedValue
record ReasoningEncryptedValue( String threadId, String runId, String subtype, String entityId, String encryptedValue, Long timestamp, Object rawEvent) implements AguiEvent承载推理已加密值数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 AguiEvent。核心成员包括 threadId、runId、subtype、entityId、encryptedValue、timestamp。
Event containing an encrypted reasoning value. Used for encrypted reasoning content (ZDR mode), where sensitive reasoning tokens are encrypted before transmission.
RunFinishedOutcome
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = RunFinishedSuccessOutcome.class, name = "success"), @JsonSubTypes.Type(value = RunFinishedInterruptOutcome.class, name = "interrupt") }) sealed interface RunFinishedOutcome permits RunFinishedSuccessOutcome, RunFinishedInterruptOutcome定义运行 Finished Outcome契约的接口。位于 io.agentscope.core.agui.event 包。
Outcome of a finished run. Can be a success or an interrupt.
RunFinishedSuccessOutcome
record RunFinishedSuccessOutcome() implements RunFinishedOutcome承载运行 Finished 成功 Outcome数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 RunFinishedOutcome。核心成员包括 RunFinishedSuccessOutcome。
Successful run outcome.
RunFinishedInterruptOutcome
record RunFinishedInterruptOutcome(List<Interrupt> interrupts) implements RunFinishedOutcome承载运行 Finished 中断 Outcome数据的记录类型。位于 io.agentscope.core.agui.event 包,实现 RunFinishedOutcome。核心成员包括 interrupts、RunFinishedInterruptOutcome。
Run outcome indicating the run was interrupted, with one or more interrupts awaiting user resolution.
Interrupt
record Interrupt( String id, String reason, String message, String toolCallId, Map<String, Object> responseSchema, String expiresAt, Map<String, Object> metadata)承载中断数据的记录类型。位于 io.agentscope.core.agui.event 包。核心成员包括 id、reason、message、toolCallId、responseSchema、expiresAt。
Represents an interrupt that occurred during agent execution, requiring user input to resolve before the agent can continue.
JsonPatchOperation
record JsonPatchOperation(String op, String path, Object value, String from)承载 JSON Patch Operation数据的记录类型。位于 io.agentscope.core.agui.event 包。核心成员包括 op、path、value、from、add、remove。
Represents a JSON Patch operation (RFC 6902). Used in StateDelta
events for
incremental state updates.