Package org.a2aproject.sdk.spec
Record Class TaskStatusUpdateEvent
java.lang.Object
java.lang.Record
org.a2aproject.sdk.spec.TaskStatusUpdateEvent
- Record Components:
taskId- the task identifier (required)status- the task status (required)contextId- the context identifier (required)metadata- additional metadata (optional)
- All Implemented Interfaces:
Event,EventKind,StreamingEventKind,UpdateEvent
public record TaskStatusUpdateEvent(String taskId, TaskStatus status, String contextId, @Nullable Map<String,Object> metadata)
extends Record
implements EventKind, StreamingEventKind, UpdateEvent
An event sent by the agent to notify the client of a change in a task's status.
This is typically used in streaming or subscription models.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructingTaskStatusUpdateEventinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe identifier when used in streaming responses -
Constructor Summary
ConstructorsConstructorDescriptionTaskStatusUpdateEvent(String taskId, TaskStatus status, String contextId, @Nullable Map<String, Object> metadata) Compact constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a new Builderbuilder(TaskStatusUpdateEvent event) Create a new Builder initialized with values from an existing TaskStatusUpdateEvent.Returns the value of thecontextIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisFinal()Indicates if this is a final status event, derived from the task state.booleanIndicates if the task is final or waiting for some inputs from the client.kind()Returns the type identifier for this event.metadata()Returns the value of themetadatarecord component.status()Returns the value of thestatusrecord component.taskId()Returns the value of thetaskIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
STREAMING_EVENT_ID
The identifier when used in streaming responses- See Also:
-
-
Constructor Details
-
TaskStatusUpdateEvent
public TaskStatusUpdateEvent(String taskId, TaskStatus status, String contextId, @Nullable Map<String, Object> metadata) Compact constructor with validation.- Parameters:
taskId- the task identifier (required)status- the task status (required)contextId- the context identifier (required)metadata- additional metadata (optional)- Throws:
IllegalArgumentException- if taskId, status, or contextId is null
-
-
Method Details
-
kind
Description copied from interface:EventKindReturns the type identifier for this event.This method provides programmatic type discrimination for routing, logging, and debugging. NOTE: This value is NOT serialized to JSON in protocol v1.0+.
- Specified by:
kindin interfaceEventKind- Specified by:
kindin interfaceStreamingEventKind- Returns:
- the event kind string (e.g., "task", "message")
-
isFinal
public boolean isFinal()Indicates if this is a final status event, derived from the task state.- Returns:
- true if the task state is terminal - false otherwise.
-
isFinalOrInterrupted
public boolean isFinalOrInterrupted()Indicates if the task is final or waiting for some inputs from the client.- Returns:
- true if the task is final or waiting for some inputs from the client - false otherwise.
-
builder
Create a new Builder- Returns:
- the builder
-
builder
Create a new Builder initialized with values from an existing TaskStatusUpdateEvent.- Parameters:
event- the TaskStatusUpdateEvent to copy values from- Returns:
- the builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
taskId
Returns the value of thetaskIdrecord component.- Returns:
- the value of the
taskIdrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
contextId
Returns the value of thecontextIdrecord component.- Returns:
- the value of the
contextIdrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-