Prompt-composition policy for AgentEngine.Turn.
A policy turns the session, the Turn-owned transcript and the advertised
tools into the message list handed to the host's :llm function. It is the
seam where a host decides how history is windowed, how instruction entries are
selected and fitted, and what shape the messages take (key type, role names).
The policy only produces messages for one call. It never changes the transcript: anything it elides or rewrites is replayed-only, and the full transcript stays with the runtime.
@behaviour AgentEngine.Turn.Compose
@impl true
def compose(session, transcript, tools, opts), do: [...]opts carries the Turn's :manifest_entry override when one was given.
session.last_usage holds the provider usage of the previous call, for
policies that window by real prompt tokens.
The default policy is AgentEngine.Turn.Compose.Default; its output is the
assembly AgentEngine.Turn used before policies existed.
Summary
Types
@type fun_policy() :: (AgentEngine.Session.t(), AgentEngine.Transcript.t(), tools(), keyword() -> [map()])
@type policy() :: module() | {module(), keyword()} | fun_policy()
@type tools() :: [LlmToolkit.Tool.t()]
Callbacks
@callback compose(AgentEngine.Session.t(), AgentEngine.Transcript.t(), tools(), keyword()) :: [map()]