AgentCall.Pending (agent_call v0.1.0)

Copy Markdown View Source

A run paused on a tool call that needs approval or on an input request.

kind discriminates the pause: :approval carries the serializable ToolCall.Approval.Request{} in approval, and :input carries the AgentCall.Input in input. The payload the kind does not use is nil.

request is the request being run and transcript is the context up to the pause, assistant turn included. results is positional: one slot per assistant tool call, in call order, holding its %LlmCall.ToolResult{} or nil when the call paused or has not run. remaining holds the calls with a nil slot in call order, the paused one first; it is empty for a turn-phase input pause. tool_calls is the run's completed tool-result total: previous turns plus the non-nil slots of this pause, so a parallel batch's completed calls are counted even when an earlier call paused.

usage is the accumulated total; last_usage is the paused turn's own usage, kept so a context policy sees the last prompt size after a resume. request is required, not optional: resume/3 receives no request and needs it to continue the conversation. run_id is the id of the run that paused; resume/3 keeps it, so the resumed run's result and events carry the same correlation id.

Summary

Types

t()

@type t() :: %AgentCall.Pending{
  approval: ToolCall.Approval.Request.t() | nil,
  input: AgentCall.Input.t() | nil,
  kind: :approval | :input,
  last_usage: LlmCall.Usage.t() | nil,
  remaining: [LlmCall.ToolCall.t()],
  request: LlmCall.Request.t(),
  results: [LlmCall.ToolResult.t() | nil],
  run_id: String.t() | nil,
  steps: non_neg_integer(),
  tool_calls: non_neg_integer(),
  transcript: [LlmCall.Message.t()],
  usage: LlmCall.Usage.t() | nil
}