AgentToolPolicy.ActionEvaluator behaviour (AgentToolPolicy v0.1.0)

Copy Markdown View Source

This behaviour defines caller-selected inspectors for pending agent tool actions.

Evaluators can implement mode/0 as :enforce or :shadow. An enforced block can gate execution. A shadow block becomes a flag. mode/0 is optional. AgentToolPolicy.ActionGuard uses :enforce by default.

Summary

Types

This type represents an action under review. The caller-defined ctx remains opaque.

A finding includes a verdict and an optional reason.

Types

action()

@type action() :: %{
  :name => String.t(),
  :arguments => map(),
  :class => AgentToolPolicy.ActionPolicy.action_class(),
  optional(:ctx) => map()
}

This type represents an action under review. The caller-defined ctx remains opaque.

finding()

@type finding() :: %{verdict: :safe | :flag | :block, reason: String.t() | nil}

A finding includes a verdict and an optional reason.

Callbacks

evaluate(action)

@callback evaluate(action()) :: finding()

mode()

(optional)
@callback mode() :: :shadow | :enforce