A2aEngine.Types.DataPart (a2a_engine v0.1.0)

Copy Markdown View Source

A structured data segment within a message or artifact.

Wire shape: {"kind": "data", "data": <object>, "metadata": <map?>}.

Checkpoint-in-envelope convention

DataPart is the carrier for the "checkpoint-in-envelope" pattern. A worker (or caller) stashes opaque resumable state here and tags the part via metadata so the broker can route it back to the producer only:

%A2aEngine.Types.DataPart{
  data: %{ ... serialized worker/session state ... },
  metadata: %{
    "type" => "checkpoint",
    "owner" => "my-worker",
    "session" => "sess_abc123"
  }
}

The A2A spec treats data and metadata as opaque; the convention lives in application code. See A2aEngine moduledoc.

Summary

Types

t()

@type t() :: %A2aEngine.Types.DataPart{data: map(), metadata: map() | nil}

Functions

from_map(m)

@spec from_map(map()) :: {:ok, t()} | {:error, term()}

to_map(t)

@spec to_map(t()) :: map()