Artifact

Artifact

An Artifact in the A2A protocol represents the output generated by an Agent as the final result of a Task.

Artifact Features

  • Immutability: Once generated, the content of an artifact is generally immutable.
  • Naming: Artifacts can be named (name) for easy identification.
  • Multi-part: An artifact can contain multiple parts (parts), each with its own content and type.
  • Streaming Support: Through streaming responses (append: true), new parts (Part) can be appended to an existing artifact, suitable for scenarios involving gradual content generation or large data transfer.
  • Multi-Artifact Tasks: A single task can generate multiple artifacts. For example, a “create webpage” task might generate one HTML artifact and one or more image artifacts.

Artifact Interface Definition

Below is an illustrative definition of the Artifact interface:

interface Artifact {
  name?: string; // Optional name for the artifact
  description?: string; // Optional description for the artifact
  parts: Part[]; // Array of parts contained within the artifact
  metadata?: Record<string, any>; // Extended metadata
  index: number; // Index of the artifact within its owning task
  append?: boolean; // Whether appending Parts is allowed (for streaming)
  lastChunk?: boolean; // Whether this is the last chunk in a stream
}

Artifacts are the standard way to convey the final output of an agent in the A2A protocol. Their design accommodates common output forms in current AI applications, such as text, code, images, and progressively generated content.