Normandy.Behaviours.Config (normandy v2.2.0)

View Source

Explicit, per-agent selection of the pluggable behaviours.

One {module, opts} ref per behaviour plus the two first-class hook lists. hooks is an ordered list of Normandy.Behaviours.Hooks entries, persisted with the refs. Carried on BaseAgentConfig.behaviours; defaults to the all-defaults bundle, so the "everything off" path is observably identical to today.

to_pipeline/1 adapts the dispatch-path slots (policy, budget, before_hooks, after_hooks, and the before_tool/after_tool callbacks of hooks) into a %Normandy.Agents.Dispatch.Pipeline{}. Classification (policy, before_hooks) gets the agent's whole config; execution (budget, the tool, after_tool, after_hooks) runs in a tool task whose config has the memory without its entries (the turn id stays), on every shell. Building it here (not on Dispatch) keeps the Phase 1 chokepoint untouched — the dependency points Phase 2 → Phase 1. The credential, compactor and model_catalog slots are not dispatch-path concerns and are not placed on the pipeline. credential has no default: a Normandy.Behaviours.CredentialProvider ref is needed only by a Turn.Session with a :template_provider, which refuses a config without one. compactor selects the :steering-boundary compaction strategy. Where sessions persist is not chosen here: Normandy.Agents.Turn.Server takes :store and :registry (the 1.x session_store/session_registry slots were never read and are gone).

Summary

Functions

Builds a %Dispatch.Pipeline{} from the dispatch-path slots of the bundle.

Types

hook()

@type hook() :: (term(), term() -> term()) | (term(), term(), term() -> term())

ref()

@type ref() :: {module(), keyword()}

t()

@type t() :: %Normandy.Behaviours.Config{
  after_hooks: [hook()],
  before_hooks: [hook()],
  budget: ref(),
  compactor: ref(),
  credential: ref() | nil,
  hooks: [Normandy.Behaviours.Hooks.entry()],
  model_catalog: ref(),
  policy: ref()
}

Functions

to_pipeline(bundle)

@spec to_pipeline(t() | nil) :: Normandy.Agents.Dispatch.Pipeline.t()

Builds a %Dispatch.Pipeline{} from the dispatch-path slots of the bundle.

nil resolves to the default bundle. execute_fn is set to the bare executor, which passes the call's %Normandy.Tools.Context{} (matching Dispatch.default_pipeline/0); callers that need telemetry (e.g. BaseAgent) override execute_fn after building.