ExAgent.Result (ExAgent v3.0.0)

View Source

Terminal result of an agent run. On success, output_mode records how the result was finalized. The modes are :text, :tool, :native and :prompted. A tool output identifies its selected branch in output_name. With ExAgent.Plan, plan contains the current run's checklist. The live model can contain credentials. A handoff sets handoff_target to the last destination ID and keeps the originating model in model for the next turn.

usage_status describes the available usage measurements. :complete covers the full input and output token counts with no partial dimensions. :partial carries a known subtotal or non-token measurements without full token coverage. :unknown indicates no measured counts. cost_cents is the full estimated price when known. Read any subtotal in usage.accounting["cost"]["subtotal_cents"].

Stability — Stable.

Summary

Functions

Citations from the last model response of a successful run.

Types

output_mode()

@type output_mode() :: :text | :tool | :native | :prompted

status()

@type status() :: :succeeded | :paused | :failed | :cancelled

t()

@type t() :: %ExAgent.Result{
  attempt_id: String.t() | nil,
  continuation: map() | nil,
  continuation_checkpoint: map() | nil,
  cost_cents: number() | nil,
  cost_status: :known | :unknown,
  effect_attempts: %{optional(String.t()) => non_neg_integer()},
  handoff_target: String.t() | nil,
  historical_uncertainty: map() | nil,
  max_checkpoint_bytes: pos_integer() | nil,
  messages: [ExAgent.Message.t()],
  model: ExAgent.Model.model(),
  model_request_id: String.t() | nil,
  new_messages: [ExAgent.Message.t()],
  output: term(),
  output_mode: output_mode() | nil,
  output_name: String.t() | nil,
  parent_run_id: String.t() | nil,
  pending_response: ExAgent.Message.Response.t() | nil,
  plan: [map()] | nil,
  request_count: non_neg_integer(),
  retention: map() | nil,
  root_run_id: String.t(),
  run_id: String.t(),
  run_step: non_neg_integer(),
  status: status(),
  tool_calls: non_neg_integer(),
  usage: ExAgent.Message.Usage.t(),
  usage_status: :complete | :partial | :unknown
}

Functions

citations(result)

(candidate API)
@spec citations(t()) :: [ExAgent.Message.Citation.t()]

Citations from the last model response of a successful run.

Answer ranges require a :text completion with the original answer bytes. The other output modes keep the source references and source ranges. For the model's original spans, read the response in new_messages with Response.citations/1.