ExAgent.Message.Part.ToolReturn (ExAgent v2.0.1)

View Source

The return value of a tool call, fed back to the model.

usage is an optional contributed token usage (e.g. from a delegated sub-agent run) that the agent loop merges into the run's accumulated usage. It is nil for ordinary tools and is not part of the serialized message history (usage is accounted for at runtime).

payload_omitted distinguishes an omitted value from a genuine nil result. Status describes the effect even when its payload was omitted. Such history is diagnostic and cannot be executed as ordinary model context.

Summary

Types

status()

@type status() ::
  :succeeded | :validation_error | :denied | :failed | :unknown | :not_executed

t()

@type t() :: %ExAgent.Message.Part.ToolReturn{
  content: term(),
  payload_omitted: term(),
  status: status(),
  tool_call_id: String.t(),
  tool_name: String.t(),
  usage: ExAgent.Message.Usage.t() | nil
}