# `Imp.Predict.ProgramOfThought`
[🔗](https://github.com/deepfates/imp/blob/v0.18.1/lib/imp/predict/program_of_thought.ex#L1)

Generates and executes a small BEAM-safe program, regenerating failed code.

Program execution uses `Imp.Sandbox`; generated source is never passed to
`Code.eval_string/3` or an external runtime. When execution fails, the next
planner call receives the previous program and its error. If the sandbox
value cannot directly satisfy the declared outputs, a final LM call extracts
those outputs from the program, value, and execution trajectory.

# `t`

```elixir
@type t() :: %Imp.Predict.ProgramOfThought{
  max_iters: pos_integer(),
  output_field: atom() | String.t(),
  predict: struct(),
  signature: Imp.Signature.t()
}
```

# `new`

```elixir
@spec new(term(), keyword()) :: t()
```

Builds a ProgramOfThought predictor.

`:max_iters` is the total number of generation and regeneration attempts and
defaults to `3`. The retry budget is retained by portable save/load.

---

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