Imp.Predict.CodeAct (Imp v0.5.0)

Copy Markdown View Source

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.

Summary

Functions

Builds a bounded CodeAct predictor with an allowlisted tool catalog.

Types

t()

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

Functions

new(signature, tools \\ [], opts \\ [])

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

Builds a bounded CodeAct predictor with an allowlisted tool catalog.