Package org.a2aproject.sdk.spec
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructingTaskArtifactUpdateEventinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe identifier when used in streaming responses -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Booleanappend()Returns the value of theappendrecord component.artifact()Returns the value of theartifactrecord component.builder()Creates a new Builderbuilder(TaskArtifactUpdateEvent event) Creates a new Builder initialized with values from an existing TaskArtifactUpdateEvent.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.kind()Returns the type identifier for this event.@Nullable BooleanReturns the value of thelastChunkrecord component.metadata()Returns the value of themetadatarecord 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
-
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
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")
-
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
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
-
artifact
Returns the value of theartifactrecord component.- Returns:
- the value of the
artifactrecord component
-
contextId
Returns the value of thecontextIdrecord component.- Returns:
- the value of the
contextIdrecord component
-
append
Returns the value of theappendrecord component.- Returns:
- the value of the
appendrecord component
-
lastChunk
Returns the value of thelastChunkrecord component.- Returns:
- the value of the
lastChunkrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-