Holds the runtime state for a single agent execution.
Internal to a run's lifecycle inside BeamAgent.Runner — not the public
result type (that's BeamAgent.Run, built from this via
BeamAgent.Run.Builder once the run finishes or fails).
Summary
Functions
Appends an assistant reply to the run's context.
Appends a tool result to the run's context.
Milliseconds elapsed (monotonic clock) since the state was created.
Marks the state :failed with the given reason.
Marks the state :finished with the given result (the model's final reply).
Increments the loop iteration counter by one.
Increments the tool-call counter by one.
Starts a fresh, :running state for goal.
Replaces the run's context (used after compression).
Appends one trace step of type with payload, tagged with the current iteration.
Types
@type status() :: :running | :finished | :failed
@type t() :: %BeamAgent.State{ context: BeamAgent.Context.t(), goal: String.t(), iteration: non_neg_integer(), result: term() | nil, started_at: DateTime.t(), started_at_monotonic: integer(), status: status(), tool_calls: non_neg_integer(), trace: [BeamAgent.Trace.Step.t()] }
Functions
Appends an assistant reply to the run's context.
Appends a tool result to the run's context.
@spec elapsed_ms(t()) :: non_neg_integer()
Milliseconds elapsed (monotonic clock) since the state was created.
Marks the state :failed with the given reason.
Marks the state :finished with the given result (the model's final reply).
Increments the loop iteration counter by one.
Increments the tool-call counter by one.
Starts a fresh, :running state for goal.
@spec put_context(t(), BeamAgent.Context.t()) :: t()
Replaces the run's context (used after compression).
Appends one trace step of type with payload, tagged with the current iteration.