Record Class TaskArtifactUpdateEvent

java.lang.Object
java.lang.Record
org.a2aproject.sdk.spec.TaskArtifactUpdateEvent
Record Components:
taskId - the task identifier (required)
artifact - the artifact being updated (required)
contextId - the context identifier (required)
append - whether to append to existing artifact (optional)
lastChunk - whether this is the final chunk (optional)
metadata - additional metadata (optional)
All Implemented Interfaces:
Event, EventKind, StreamingEventKind, UpdateEvent

public record TaskArtifactUpdateEvent(String taskId, Artifact artifact, String contextId, @Nullable Boolean append, @Nullable Boolean lastChunk, @Nullable Map<String,Object> metadata) extends Record implements EventKind, StreamingEventKind, UpdateEvent
Event notifying that a task artifact has been created, modified, or appended to.

TaskArtifactUpdateEvent is emitted during streaming operations to deliver partial or complete artifacts as they become available. This enables progressive result delivery and real-time feedback for long-running operations.

The event supports two primary patterns:

  • Complete artifacts - New artifacts added to the task (append=false or null)
  • Incremental chunks - Content appended to existing artifacts (append=true)

Use cases include:

  • Streaming text generation (progressive LLM responses)
  • Incremental file generation (large documents built over time)
  • Partial results (early outputs before complete analysis)

The lastChunk flag indicates whether this is the final update for an artifact, allowing clients to distinguish between intermediate and final states.

See Also:
  • Field Details

    • STREAMING_EVENT_ID

      public static final String STREAMING_EVENT_ID
      The identifier when used in streaming responses
      See Also:
  • Constructor Details

    • TaskArtifactUpdateEvent

      public TaskArtifactUpdateEvent(String taskId, Artifact artifact, String contextId, @Nullable Boolean append, @Nullable Boolean lastChunk, @Nullable Map<String,Object> metadata)
      Compact constructor with validation.
      Parameters:
      taskId - the task identifier (required)
      artifact - the artifact being updated (required)
      contextId - the context identifier (required)
      append - whether to append to existing artifact (optional)
      lastChunk - whether this is the final chunk (optional)
      metadata - additional metadata (optional)
      Throws:
      IllegalArgumentException - if taskId, artifact, 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")
    • builder

      public static TaskArtifactUpdateEvent.Builder builder()
      Creates a new Builder
      Returns:
      the builder
    • builder

      Creates a new Builder initialized with values from an existing TaskArtifactUpdateEvent.
      Parameters:
      event - the TaskArtifactUpdateEvent 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
    • artifact

      public Artifact artifact()
      Returns the value of the artifact record component.
      Returns:
      the value of the artifact record component
    • contextId

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

      public @Nullable Boolean append()
      Returns the value of the append record component.
      Returns:
      the value of the append record component
    • lastChunk

      public @Nullable Boolean lastChunk()
      Returns the value of the lastChunk record component.
      Returns:
      the value of the lastChunk 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