State carried through an Arcana.Loop run.
This is the loop's working memory. It accumulates chunks across iterations, records the tool history, and tracks termination state.
Fields
:question- The original user question.:repo- Ecto repo to use for retrieval tools.:collections- Collections to scope retrieval tools to (list of names).:messages- TheReqLLM.Contextcarrying the running conversation.:chunks- Accumulated chunks fromsearchtool calls (capped via:chunk_cap).:tool_history- List of%{tool, args, iteration, summary}entries in call order.:iterations- Number of LLM controller turns executed.:answer- Final answer text once the loop terminates.:terminated_by- One of:answered,:gave_up,:max_iterations,:error, ornil.:error- Error reason whenterminated_by == :error.:grounding- Populated byArcana.Loop.ground/2with an%Arcana.Grounding.Result{}scoring the answer againstctx.chunks.niluntil grounding runs.
Summary
Types
@type t() :: %Arcana.Loop.Context{ answer: String.t() | nil, chunks: [map()], collections: [String.t() | nil], error: term() | nil, grounding: Arcana.Grounding.Result.t() | nil, iterations: non_neg_integer(), messages: term() | nil, question: String.t(), repo: module() | nil, terminated_by: atom() | nil, tool_history: [tool_history_entry()] }
@type tool_history_entry() :: %{ tool: atom(), args: map(), iteration: non_neg_integer(), summary: String.t() }