Upgrading from 0.0.x? See the 0.1.0 migration guide — schemas moved to a new subpath and zod is now an optional peer dependency.
Events
The Agent User Interaction Protocol SDK uses a streaming event-based architecture. Events are the fundamental units of communication between agents and the frontend. This section documents the event types and their properties.EventType Enum
TheEventType enum defines all possible event types in the system:
BaseEvent
All events inherit from theBaseEvent type, which provides common properties
shared across all event types.
Lifecycle Events
These events represent the lifecycle of an agent run.RunStartedEvent
Signals the start of an agent run.RunFinishedEvent
Signals the successful completion of an agent run.RunErrorEvent
Signals an error during an agent run.StepStartedEvent
Signals the start of a step within an agent run.StepFinishedEvent
Signals the completion of a step within an agent run.Text Message Events
These events represent the lifecycle of text messages in a conversation.TextMessageStartEvent
Signals the start of a text message.TextMessageContentEvent
Represents a chunk of content in a streaming text message.TextMessageEndEvent
Signals the end of a text message.TextMessageChunkEvent
Convenience event that expands toTextMessageStart → TextMessageContent →
TextMessageEnd automatically in the JS/TS client.
- Omit start/end: The client transforms chunk sequences into the standard start/content/end triad, so you don’t need to emit them manually.
- First chunk requirements: The first chunk for a message must include
messageId. Whenroleis omitted, it defaults toassistant. - Streaming: Subsequent chunks with the same
messageIdemitTextMessageContentevents.TextMessageEndis emitted automatically when a different message starts or when the stream completes.
Tool Call Events
These events represent the lifecycle of tool calls made by agents.ToolCallStartEvent
Signals the start of a tool call.ToolCallArgsEvent
Represents a chunk of argument data for a tool call.ToolCallEndEvent
Signals the end of a tool call.ToolCallResultEvent
Provides the result of a tool call execution.State Management Events
These events are used to manage agent state.StateSnapshotEvent
Provides a complete snapshot of an agent’s state.StateDeltaEvent
Provides a partial update to an agent’s state using JSON Patch.MessagesSnapshotEvent
Provides a snapshot of all messages in a conversation.ActivitySnapshotEvent
Delivers a complete snapshot of an activity message.ActivityDeltaEvent
Provides incremental updates to an activity snapshot using JSON Patch.Reasoning Events
These events represent the lifecycle of reasoning/thinking processes within an agent. Reasoning events allow agents to expose their internal thought process to the frontend, creatingReasoningMessage objects that persist in the message
history with the role "reasoning".
ReasoningStartEvent
Signals the start of a reasoning phase. This is a pass-through event that notifies subscribers but does not create messages.ReasoningMessageStartEvent
Signals the start of a reasoning message. Creates a newReasoningMessage in
the message history.
ReasoningMessageContentEvent
Represents a chunk of content in a streaming reasoning message.ReasoningMessageEndEvent
Signals the end of a reasoning message.ReasoningMessageChunkEvent
Convenience event that expands toReasoningMessageStart →
ReasoningMessageContent → ReasoningMessageEnd automatically in the JS/TS
client.
- Omit start/end: The client transforms chunk sequences into the standard start/content/end triad.
- First chunk requirements: The first chunk for a message must include
messageId. - Streaming: Subsequent chunks with the same
messageIdemitReasoningMessageContentevents.ReasoningMessageEndis emitted automatically when a different message starts or when the stream completes.
ReasoningEndEvent
Signals the end of a reasoning phase. This is a pass-through event that notifies subscribers but does not modify messages.ReasoningEncryptedValueEvent
Attaches an encrypted value to a message or tool call. When this event is emitted, it finds the referenced entity byentityId and sets its
encryptedValue field.
Special Events
RawEvent
Used to pass through events from external systems.CustomEvent
Used for application-specific custom events.Deprecated Events
Thinking Events (Deprecated)
The following event types are deprecated:
See Reasoning Migration
for detailed migration guidance.
Event validation
@ag-ui/core ships TypeScript types for every event but does not bundle a runtime
schema validator in its main entry. The zod schemas live on an opt-in subpath:
@ag-ui/core/schemas. Install it explicitly
if you import from this module:
@ag-ui/core are the contract.
ToolCallChunkEvent
Convenience event that expands toToolCallStart → ToolCallArgs →
ToolCallEnd automatically in the JS/TS client.
- Omit start/end: The client transforms chunk sequences into the standard start/args/end triad.
- First chunk requirements: The first chunk must include both
toolCallIdandtoolCallName;parentMessageIdis propagated toToolCallStartif given. - Streaming: Subsequent chunks with the same
toolCallIdemitToolCallArgs.ToolCallEndis emitted automatically when the tool call changes or when the stream completes.