Record Class Artifact
- Record Components:
artifactId- the unique identifier for this artifact (required)name- the human-readable name of the artifact (optional)description- a brief description of the artifact's purpose or content (optional)parts- the content parts comprising the artifact (required, must not be empty)metadata- additional key-value metadata for the artifact (optional)extensions- protocol extensions used in this artifact (optional)
Artifacts are outputs created by agents in response to user requests. They can represent various types of content including documents, data structures, analysis results, generated files, or any other structured output from agent operations.
Each artifact has a unique identifier and contains content through Parts, which allow
for multi-modal output (text, files, structured data). Artifacts can include metadata for
additional context and support protocol extensions.
Artifacts are typically delivered to clients through Task responses or
TaskArtifactUpdateEvent events in streaming scenarios.
This class is immutable. Use the Artifact.Builder for construction.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing immutableArtifactinstances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theartifactIdrecord component.static Artifact.Builderbuilder()Create a new Builderstatic Artifact.BuilderCreate a new Builder initialized with values from an existing Artifact.@Nullable StringReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextensionsrecord component.final inthashCode()Returns a hash code value for this object.metadata()Returns the value of themetadatarecord component.@Nullable Stringname()Returns the value of thenamerecord component.parts()Returns the value of thepartsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Artifact
public Artifact(String artifactId, @Nullable String name, @Nullable String description, List<Part<?>> parts, @Nullable Map<String, Object> metadata, @Nullable List<String> extensions) Compact constructor that validates required fields.- Parameters:
artifactId- the artifactId parameter (see class-level JavaDoc)name- the name parameter (see class-level JavaDoc)description- the description parameter (see class-level JavaDoc)parts- the parts parameter (see class-level JavaDoc)metadata- the metadata parameter (see class-level JavaDoc)extensions- the extensions parameter (see class-level JavaDoc)- Throws:
IllegalArgumentException- if artifactId or parts is null, or if parts is empty
-
-
Method Details
-
builder
Create a new Builder- Returns:
- the builder
-
builder
Create a new Builder initialized with values from an existing Artifact.This builder creates defensive copies of mutable collections to ensure that modifications to the builder do not affect the original Artifact.
- Parameters:
artifact- the Artifact 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). -
artifactId
Returns the value of theartifactIdrecord component.- Returns:
- the value of the
artifactIdrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
parts
Returns the value of thepartsrecord component.- Returns:
- the value of the
partsrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-
extensions
Returns the value of theextensionsrecord component.- Returns:
- the value of the
extensionsrecord component
-