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

An input pause, and the marker for input-tool modules.

`%AgentCall.Input{}` is the payload of a `%AgentCall.Pending{kind: :input}`.
`source` says who asked — the model through a marked input-tool module, or
the caller's `prompt:` policy — and `target` what the pause replaced: the
next model turn or a specific tool call.

A model-initiated pause carries the `call` and its derived `spec`, so a UI can
render the question without a second description; the caller's answer becomes
that call's result. A policy pause carries the caller's `prompt` payload
instead: the call and spec on a tool target, neither on a turn target. A
model-source tool input therefore requires a spec and a nil prompt; a
policy-source input may omit the spec (an undeclared tool) and carries the
prompt payload.
`inserted_at` records when the pause was built.

A `prompt:` policy returns `:cont` to continue the turn, or `{:ask, payload}`
to pause with the caller's payload. The policy runs again after a resume, so
it must inspect `info.messages` and return `:cont` once it has asked; the
library keeps no already-asked state.

`use AgentCall.Input` performs `use ToolCall`, so the module's `@doc` and
`@spec` still describe its tools for the codec, and adds the
`__agent_call_input__/0` marker: inside `AgentCall` every tool the module
declares pauses instead of running. The marker is not a tool, so it carries
no `@spec` and is hidden from the docs. Using a marked module outside
`AgentCall` calls its functions normally.

# `decision`

```elixir
@type decision() :: :cont | {:ask, term()}
```

What a `prompt:` function answers: continue the run, or ask and pause.

# `info`

```elixir
@type info() :: %{
  phase: :turn | {:tool, LlmCall.ToolCall.t()},
  step: pos_integer(),
  max_steps: pos_integer(),
  usage: LlmCall.Usage.t() | nil,
  request: LlmCall.Request.t(),
  messages: [LlmCall.Message.t()],
  module: module() | nil,
  spec: LlmCall.ToolSpec.t() | nil
}
```

What `prompt:` knows at a turn or tool boundary.

`step` is the turn the phase belongs to: the turn about to start for a turn
phase, the turn that produced the call for a tool phase. `max_steps:` is the
budget, and `usage` the last response's own usage, `nil` before the first
request. `messages` is the transcript the request will carry. A tool phase
names the call's `module` and its `spec` when the name is declared; a
hallucinated name has neither, and a turn phase has neither.

# `source`

```elixir
@type source() :: :model | :policy
```

Who initiated the pause: the model's tool call or the caller's prompt policy.

# `t`

```elixir
@type t() :: %AgentCall.Input{
  call: LlmCall.ToolCall.t() | nil,
  inserted_at: DateTime.t(),
  prompt: term(),
  source: source(),
  spec: LlmCall.ToolSpec.t() | nil,
  target: target()
}
```

# `target`

```elixir
@type target() :: :turn | {:tool, LlmCall.ToolCall.t()}
```

What the pause replaced: the next model turn or a specific tool call.

# `__using__`
*macro* 

Makes a `ToolCall` module an input-tool module.

`opts` are passed to `use ToolCall`. Inside `AgentCall`, a call to any tool the
module declares pauses for input instead of invoking the function.

---

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