A2A.Message (A2A v0.2.0)

Copy Markdown View Source

A single turn of communication between user and agent.

Messages contain typed parts and are identified by role (:user or :agent).

Summary

Functions

Creates a new agent message from text or parts.

Creates a new user message from text or parts.

Extracts the text from the first A2A.Part.Text part, or nil if none.

Types

role()

@type role() :: :user | :agent

t()

@type t() :: %A2A.Message{
  context_id: String.t() | nil,
  extensions: map(),
  message_id: String.t(),
  metadata: map(),
  parts: [A2A.Part.t()],
  role: role(),
  task_id: String.t() | nil
}

Functions

new_agent(text)

@spec new_agent(String.t() | [A2A.Part.t()]) :: t()

Creates a new agent message from text or parts.

new_user(text)

@spec new_user(String.t() | [A2A.Part.t()]) :: t()

Creates a new user message from text or parts.

text(message)

@spec text(t()) :: String.t() | nil

Extracts the text from the first A2A.Part.Text part, or nil if none.