Spectre.Action.Spec (Spectre v0.3.0)

Copy Markdown View Source

Planner-facing description of an action exposed by a provider.

Specs are discovery data only. Execution always resolves the provider again from the compiled Agent definition, so a planner cannot inject an arbitrary implementation module.

Summary

Functions

Computes the stable hash used to detect provider-schema drift.

Builds a normalized spec and derives a stable schema hash when omitted.

Returns whether a spec may be exposed to a model-facing planner.

Types

t()

@type t() :: %Spectre.Action.Spec{
  description: String.t() | nil,
  id: String.t() | nil,
  metadata: map(),
  mode: atom() | nil,
  name: Spectre.Action.name(),
  schema: term(),
  schema_hash: String.t(),
  via: Spectre.Action.provider_ref(),
  visibility: :deterministic | :planner | :both
}

Functions

hash(via, name, schema)

Computes the stable hash used to detect provider-schema drift.

hash(via, name, schema, mode)

new(attrs)

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

Builds a normalized spec and derives a stable schema hash when omitted.

planner_visible?(spec)

@spec planner_visible?(t()) :: boolean()

Returns whether a spec may be exposed to a model-facing planner.