Minimal, provider-neutral transcript for the AgentEngine.Turn loop.
A transcript is an ordered list of normalized chat messages: plain maps with
string role/content keys, plus tool_calls (on assistant messages) and
tool_call_id/name (on tool messages). It is distilled from the public
recomposition path used by host applications:
%{"role" => "user", "content" => "..."}
%{"role" => "assistant", "content" => "...", "tool_calls" => [%{"id" => ..., "name" => ..., "arguments" => %{...}}]}
%{"role" => "tool", "content" => "...", "tool_call_id" => "...", "name" => "..."}Tool-call entries are stored as serialized maps (id, name, arguments),
which keeps the transcript serializable and free of provider-specific struct
coupling. A host-supplied LLM function receives these maps and may pass them
straight to a provider's message normalizer.
The transcript is a pure data structure: it never calls an LLM, never
executes tools, and owns no persistence. AgentEngine.Turn drives it.
Summary
Functions
Append an assistant message.
Append a system message. Useful for a one-shot system prompt.
Append one tool message per tool result.
Append a user message.
Create a transcript from an existing list of messages.
Create a new empty transcript.
Return the pending (unanswered) tool calls from the last assistant turn.
Return the normalized message list, ready for an LLM provider call.
Types
Functions
Append an assistant message.
Options:
:content— text content (nilwhen the message only carries tool calls):tool_calls— list of tool-call structs or maps (default[])
Tool calls are normalized to serialized maps: %{"id", "name", "arguments"}.
Append a system message. Useful for a one-shot system prompt.
Append one tool message per tool result.
Each result becomes its own tool-role message keyed by tool_call_id,
matching provider message conventions. Accepts LlmToolkit.Tool.Result
structs or equivalent maps (tool_call_id, name, content).
Append a user message.
Create a transcript from an existing list of messages.
Each message is normalized to a string-keyed map via normalize/1.
@spec new() :: t()
Create a new empty transcript.
Return the pending (unanswered) tool calls from the last assistant turn.
A tool call is pending when its id has no subsequent tool-role message
carrying the same tool_call_id. Returns [] when the last assistant
message carries no tool calls, or when every call has been answered.
Tool calls are returned as serialized maps (%{"id", "name", "arguments"}).
Return the normalized message list, ready for an LLM provider call.