Turn one ERL-marked reasoning turn into a single flat Gralkor.AgentLearning
record via one LLM call.
Same shape as Gralkor.Distill — best-effort and parallel-friendly. The turn
is rendered with role labels and handed to the injected learn_fn (a
structured-output LLM caller); production wiring lives in
Gralkor.Client.Native. Classification and learning are one step: the record
is a single node carrying the problem kind, the approach, whether it
succeeded, and the lesson.
See ex-learn in TEST_TREES.md.
Summary
Functions
Run the LLM over turn, returning the learning record it produced.
Schema for the structured-output response the LLM returns when learning from a turn.
Types
@type turn() :: [Gralkor.Message.t()]
Functions
@spec learn(turn(), learn_fn(), String.t(), String.t()) :: {:ok, Gralkor.AgentLearning.t()} | {:error, term()}
Run the LLM over turn, returning the learning record it produced.
Returns {:error, reason} (best-effort) when learn_fn fails — the caller
writes no learning episode for that turn. Raises ArgumentError when
agent_name or user_name is blank.
@spec learn_schema() :: keyword()
Schema for the structured-output response the LLM returns when learning from a turn.