# `AgentCall.Result`
[🔗](https://github.com/gilbertwong96/agent_call/blob/main/lib/agent_call/result.ex#L1)

What a run produced.

`{:ok, result}` means the model asked for no more tools; it does not claim the
answer was complete. `stop_reason` is the final response's own
`LlmCall.stop_reason()`.

`response` and `stop_reason` are `nil` when there is no response to report: a
context policy stopped before the first request, a resumed run had no new
model turn — its next step was already beyond `max_steps:`, or the context
policy stopped before it — or a turn-phase input prompt was cancelled before
the request. `Pending` does not carry the paused turn's response, so a resumed
run reports none rather than an invented one.

`halt_reason` is `nil` for a normal finish, `:budget` when the step budget
stopped dispatch, `{:context, reason}` when the context policy stopped the
run, `{:input, reason}` when a turn-phase input prompt was cancelled, and
`{:cancelled, reason}` when the `cancel_when:` policy stopped the run at a
safe boundary. `transcript` is the model-visible context, which a policy may
have replaced; the event stream is the full history.

`run_id` is the run's correlation id: the caller's `run_id:` when supplied,
otherwise one generated by `run/3`.

# `t`

```elixir
@type t() :: %AgentCall.Result{
  halt_reason:
    nil | :budget | {:context, term()} | {:input, term()} | {:cancelled, term()},
  response: LlmCall.Response.t() | nil,
  run_id: String.t(),
  steps: non_neg_integer(),
  stop_reason: LlmCall.stop_reason() | nil,
  tool_calls: non_neg_integer(),
  transcript: [LlmCall.Message.t()],
  usage: LlmCall.Usage.t() | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
