Jido.AI.Effects.Policy (Jido AI v2.2.0)

Copy Markdown View Source

Effect policy definition and filtering for tool-emitted effects.

Summary

Functions

Returns true when an effect is permitted by the policy.

Returns the default policy.

Filters effects according to the policy.

Narrows an agent policy by a strategy policy.

Builds a policy from map/keyword input.

Types

constraints()

@type constraints() :: map()

matcher()

@type matcher() :: module()

matcher_set()

@type matcher_set() :: term()

mode()

@type mode() :: :deny_all | :allow_all | :allow_list

t()

@type t() :: %Jido.AI.Effects.Policy{
  allow: matcher_set(),
  constraints: constraints(),
  deny: matcher_set(),
  mode: mode()
}

Functions

allowed?(policy, effect)

@spec allowed?(t(), term()) :: boolean()

Returns true when an effect is permitted by the policy.

default()

@spec default() :: t()

Returns the default policy.

filter(policy, effects)

@spec filter(t() | map() | keyword() | nil, [term()]) :: {[term()], [term()]}

Filters effects according to the policy.

Returns {allowed, dropped}.

intersect(agent_policy, strategy_policy)

@spec intersect(t() | map() | keyword() | nil, t() | map() | keyword() | nil) :: t()

Narrows an agent policy by a strategy policy.

new(policy)

@spec new(t() | map() | keyword() | nil) :: t()

Builds a policy from map/keyword input.