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

CodeAct-style module backed by `Imp.Sandbox` and explicit tool iterations.

Each step asks the underlying ProgramOfThought planner for either a safe
`program` expression to evaluate or a `tool` plus `arguments` to observe
before the next step.

Tool execution is policy-gated like ReAct and Agent:

    Imp.code_act("question -> answer", [lookup],
      tool_policy: [:lookup],
      max_iters: 4
    )

Unknown, denied, or crashing tools return structured errors with the redacted
trace accumulated so far.

A call may override the constructor's iteration budget with `:max_iters` or
`"max_iters"`. The control value is validated and is never exposed as a task
input to the planner.

# `t`

```elixir
@type t() :: %Imp.Predict.CodeAct{
  max_iters: non_neg_integer(),
  program_of_thought: Imp.Predict.ProgramOfThought.t(),
  tool_policy: term(),
  tools: map()
}
```

# `new`

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

Builds a bounded CodeAct predictor with an allowlisted tool catalog.

---

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