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.
  • Field Details

    • STREAMING_EVENT_ID

      public static final String 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

      public String kind()
      Description copied from interface: EventKind
      Returns 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:
      kind in interface EventKind
      Specified by:
      kind in interface StreamingEventKind
      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

      public static TaskStatusUpdateEvent.Builder 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • taskId

      public String taskId()
      Returns the value of the taskId record component.
      Returns:
      the value of the taskId record component
    • status

      public TaskStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • contextId

      public String contextId()
      Returns the value of the contextId record component.
      Returns:
      the value of the contextId record component
    • metadata

      public @Nullable Map<String,Object> metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component