A2A Artifact: Task Outputs and Streaming Chunks
An Artifact is a tangible output that an agent generates while working on a Task : a document, an image, a block of structured data. It is the actual deliverable of the task, as opposed to the conversation around it. Like a message, an artifact is made of Parts .
Collecting task results? The Task runtime guide connects artifact updates with task state, streaming and recovery. For a collaboration walkthrough that retrieves a specialist’s output, see Agent collaboration for ticket analysis ; its interaction examples have not been tested end to end.
Fields
| Field | Required | Description |
|---|---|---|
artifactId | Yes | Unique identifier for the artifact. It must be unique within the task |
parts | Yes | The content, as a list of Parts . It must contain at least one part |
name | No | A human-readable name |
description | No | A human-readable description |
metadata | No | Extra key-value metadata |
extensions | No | URIs of extensions present in or contributed to this artifact |
Artifacts live in the artifacts list of a Task. ListTasks leaves them out of the response unless the request sets includeArtifacts to true, to keep payloads small.
Artifacts, not messages, carry results
The core interaction in A2A is that a client sends messages to start a task, and the task produces one or more artifacts. The specification says messages SHOULD NOT be used to deliver task outputs, and that results SHOULD be returned as artifacts. See Message for what messages are for.
This is a completed task that carries one text artifact, from the specification’s basic scenario:
{
"id": "task-uuid",
"contextId": "context-uuid",
"status": {"state": "TASK_STATE_COMPLETED"},
"artifacts": [{
"artifactId": "artifact-uuid",
"name": "Weather Report",
"parts": [{"text": "Today will be sunny with a high of 75°F"}]
}]
}The same shape carries files. In the file exchange scenario the agent returns an image as an artifact whose part points to the content by url, and the Part
page shows that full response.
Streaming artifacts in chunks
A long result does not have to wait for the task to finish. With streaming, the agent sends a TaskArtifactUpdateEvent, delivered as an artifactUpdate, whenever a new artifact or a new piece of one is available. The event has these fields:
| Field | Description |
|---|---|
taskId, contextId | The task the artifact belongs to, and its context |
artifact | The artifact that was generated or updated |
append | If true, append this content to a previously sent artifact with the same ID |
lastChunk | If true, this is the final chunk of the artifact |
metadata | Optional metadata about the update |
This trace shows one artifact assembled from two chunks inside a single task — the same trace used on the Task and Streaming and Asynchronous Operations pages:
HTTP/1.1 200 OK
Content-Type: text/event-stream
data: {"task": {"id": "task-8f20", "contextId": "ctx-41ab", "status": {"state": "TASK_STATE_WORKING"}}}
data: {"artifactUpdate": {"taskId": "task-8f20", "contextId": "ctx-41ab", "artifact": {"artifactId": "artifact-77c3", "name": "trip-plan.md", "parts": [{"text": "# Trip Plan\n\nDay 1: "}]}}}
data: {"artifactUpdate": {"taskId": "task-8f20", "contextId": "ctx-41ab", "append": true, "lastChunk": true, "artifact": {"artifactId": "artifact-77c3", "name": "trip-plan.md", "parts": [{"text": "arrive, check in, sunset walk."}]}}}
data: {"statusUpdate": {"taskId": "task-8f20", "contextId": "ctx-41ab", "status": {"state": "TASK_STATE_COMPLETED"}}}Both artifactUpdate events name the same artifactId, so they describe one artifact, not two. Read the three moments in order:
- The first chunk arrives unmarked. No
append, nolastChunk: it starts the artifact with thatartifactIdand its first parts. - The second chunk ends the chunk sequence.
append: trueextends the artifact with that ID — it does not start a new one — andlastChunk: truemarks this chunk as the artifact’s last. The task itself is not finished yet. - Only then the terminal
statusUpdate. The task completes after the last chunk; the stream closes with the terminal state.
Assembled from the two chunks, the artifact’s text is:
# Trip Plan
Day 1: arrive, check in, sunset walk.Streaming requires capabilities.streaming: true in the Agent Card. The event stream for a task begins with the Task and closes when the task reaches a terminal state. See Streaming and Asynchronous Operations
.
Refining an artifact
A task that reached a terminal state cannot be reopened, so a refinement is a new task in the same contextId, and its output is a new artifact. In the Life of a Task
example, the agent first generates a sailboat image. The artifact from the first task:
{
"artifactId": "artifact-boat-v1-xyz",
"name": "sailboat_image.png",
"description": "A generated image of a sailboat on the ocean.",
"parts": [
{
"filename": "sailboat_image.png",
"mediaType": "image/png",
"raw": "base64_encoded_png_data_of_a_sailboat"
}
]
}After the client asks for a red boat, the new task produces an artifact with the same name and a new artifactId:
{
"artifactId": "artifact-boat-v2-red-pqr",
"name": "sailboat_image.png",
"description": "A generated image of a red sailboat on the ocean.",
"parts": [
{
"filename": "sailboat_image.png",
"mediaType": "image/png",
"raw": "base64_encoded_png_data_of_a_RED_sailboat"
}
]
}Tracking which artifact replaces which is a client concern and is not part of the A2A specification. The guidance is for serving agents to reuse a consistent artifact name for a refined version, and for clients to keep their own version history and name the exact artifact they want refined, ideally the latest one from their point of view.
Related pages
- Task : where artifacts are stored and how tasks end.
- Part : what an artifact contains.
- Task Runtime Guide : how artifacts arrive on the event stream, how to check the event order, and how to recover from a dropped stream.
- Data Structures : the complete field reference.
Assembling results without confusing completion
Use (taskId, artifactId) as the local assembly key. A display name is unsuitable: a task may have several outputs, and a later task can deliberately reuse a name for a refined result. Apply an update with append: true to the existing artifact with that ID; do not concatenate every event indiscriminately.
lastChunk completes that artifact’s chunk sequence, not the whole task. Conversely, an open connection does not prove that useful output is still arriving. Track artifact assembly and task status separately, and expose a partial result as partial until the task reaches the relevant final state.
After a dropped connection, separate two moves. Reconcile first: compare your local assembly with the artifacts of the task retrieved through GetTask — or with the Task snapshot in the first event of a resubscribed stream. That snapshot is the server’s current, already-assembled view: calibrate against it, and do not append the parts it already contains onto your local chunks a second time. Then keep receiving: a chunk that arrives after the snapshot extends that same view — same artifactId, append: true when it continues earlier parts, lastChunk: true when the artifact’s sequence ends. Resubscribing is not a promise to replay every missed chunk or to deliver each event exactly once. If a complete result cannot be established, show its incomplete status rather than silently presenting duplicated or truncated output. The recovery guide
covers the surrounding request and persistence decisions.
Source: A2A official specification: Artifact, Streaming Events, and Common Workflows and Life of a Task