ExAgent.Skill (ExAgent v0.2.0)

Copy Markdown View Source

Loadable skill definition for progressive disclosure pattern.

A skill represents a specialized persona with its own system prompt, tools, and an optional activation function that determines when the skill should be dynamically loaded based on conversation context.

Summary

Functions

Creates a new skill with validated attributes.

Types

t()

@type t() :: %ExAgent.Skill{
  activation_fn: (ExAgent.Context.t() -> boolean()) | nil,
  name: String.t(),
  system_prompt: String.t(),
  tools: [ExAgent.Tool.t()]
}

Functions

new(attrs)

@spec new(keyword()) :: {:ok, t()} | {:error, String.t()}

Creates a new skill with validated attributes.

Examples

iex> {:ok, skill} = ExAgent.Skill.new(name: "expert", system_prompt: "You are an expert")
iex> skill.name
"expert"

iex> ExAgent.Skill.new(system_prompt: "Expert")
{:error, "name is required"}

iex> ExAgent.Skill.new(name: "expert")
{:error, "system_prompt is required"}