Wardrik. Definition
(wardrik_protocol v0.1.0-rc.1)
Copy Markdown
What an agent is and what it may do: an agent file's frontmatter, as a struct.
definition =
Wardrik.Definition.new!(
model: "anthropic:claude-haiku-4-5",
instructions: "You watch the incident queue.",
tools: ["linear/*"],
policy: [ask: ["linear/*"]]
)
Wardrik.Agent.define(scope, "acme/triage", definition)
#=> {:ok, %Wardrik.Agent{id: "acme/triage", status: :idle, ...}}Its fields follow the protocol's agent_definition schema. Tools and policies it names must be
ones Wardrik offers. See Wardrik.start_link/1.
:policy, :workspace, :context, :retries, :compaction and :notify stay as the
protocol's JSON. Each of :triggers is a Wardrik.Trigger.
Summary
Functions
Builds one from the protocol's JSON.
Names each unnamed trigger by its position: trigger-1, trigger-2, and so on.
Builds a definition from a keyword list or map. Raises ArgumentError if it doesn't match the schema.
Returns the principal the agent id acts as: its user, as acme/@maria, or its org, as acme.
Returns it as the protocol's JSON, without fields that are nil.
Types
@type t() :: %Wardrik.Definition{ channels: term(), compaction: term(), context: term(), description: term(), display_name: term(), idle_timeout: term(), instructions: term(), max_iterations: term(), model: term(), notify: term(), policy: term(), retries: term(), timeout: term(), tools: term(), triggers: term(), workspace: term() }
Functions
Builds one from the protocol's JSON.
Names each unnamed trigger by its position: trigger-1, trigger-2, and so on.
Takes and returns the definition as the protocol's JSON.
Builds a definition from a keyword list or map. Raises ArgumentError if it doesn't match the schema.
@spec principal(String.t()) :: WardrikCore.Principal.t()
Returns the principal the agent id acts as: its user, as acme/@maria, or its org, as acme.
Raises MatchError if id isn't an agent ID.
Returns it as the protocol's JSON, without fields that are nil.