Class ArtifactUtils

java.lang.Object
org.a2aproject.sdk.server.util.ArtifactUtils

public final class ArtifactUtils extends Object
Utility functions for creating A2A Artifact objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.a2aproject.sdk.spec.Artifact
    newArtifact(String name, List<org.a2aproject.sdk.spec.Part<?>> parts)
    Creates a new Artifact object with empty description.
    static org.a2aproject.sdk.spec.Artifact
    newArtifact(String name, List<org.a2aproject.sdk.spec.Part<?>> parts, @Nullable String description)
    Creates a new Artifact object.
    static org.a2aproject.sdk.spec.Artifact
    Creates a new Artifact object containing only a single DataPart with empty description.
    static org.a2aproject.sdk.spec.Artifact
    newDataArtifact(String name, Object data, @Nullable String description)
    Creates a new Artifact object containing only a single DataPart.
    static org.a2aproject.sdk.spec.Artifact
    Creates a new Artifact object containing only a single TextPart with empty description.
    static org.a2aproject.sdk.spec.Artifact
    newTextArtifact(String name, String text, @Nullable String description)
    Creates a new Artifact object containing only a single TextPart.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newArtifact

      public static org.a2aproject.sdk.spec.Artifact newArtifact(String name, List<org.a2aproject.sdk.spec.Part<?>> parts, @Nullable String description)
      Creates a new Artifact object.
      Parameters:
      name - The human-readable name of the artifact.
      parts - The list of Part objects forming the artifact's content.
      description - An optional description of the artifact.
      Returns:
      A new Artifact object with a generated artifact_id.
    • newArtifact

      public static org.a2aproject.sdk.spec.Artifact newArtifact(String name, List<org.a2aproject.sdk.spec.Part<?>> parts)
      Creates a new Artifact object with empty description.
      Parameters:
      name - The human-readable name of the artifact.
      parts - The list of Part objects forming the artifact's content.
      Returns:
      A new Artifact object with a generated artifact_id.
    • newTextArtifact

      public static org.a2aproject.sdk.spec.Artifact newTextArtifact(String name, String text, @Nullable String description)
      Creates a new Artifact object containing only a single TextPart.
      Parameters:
      name - The human-readable name of the artifact.
      text - The text content of the artifact.
      description - An optional description of the artifact.
      Returns:
      A new Artifact object with a generated artifact_id.
    • newTextArtifact

      public static org.a2aproject.sdk.spec.Artifact newTextArtifact(String name, String text)
      Creates a new Artifact object containing only a single TextPart with empty description.
      Parameters:
      name - The human-readable name of the artifact.
      text - The text content of the artifact.
      Returns:
      A new Artifact object with a generated artifact_id.
    • newDataArtifact

      public static org.a2aproject.sdk.spec.Artifact newDataArtifact(String name, Object data, @Nullable String description)
      Creates a new Artifact object containing only a single DataPart.

      Supports any JSON value type: objects (Map), arrays (List), primitives (String, Number, Boolean), or null.

      Parameters:
      name - The human-readable name of the artifact.
      data - The structured data content of the artifact (JSON object, array, primitive, or null).
      description - An optional description of the artifact.
      Returns:
      A new Artifact object with a generated artifact_id.
    • newDataArtifact

      public static org.a2aproject.sdk.spec.Artifact newDataArtifact(String name, Object data)
      Creates a new Artifact object containing only a single DataPart with empty description.

      Supports any JSON value type: objects (Map), arrays (List), primitives (String, Number, Boolean), or null.

      Parameters:
      name - The human-readable name of the artifact.
      data - The structured data content of the artifact (JSON object, array, primitive, or null).
      Returns:
      A new Artifact object with a generated artifact_id.