ExAgent.Patterns.Skills (ExAgent v0.2.0)

Copy Markdown View Source

Progressive disclosure pattern.

Allows a single agent to dynamically load specialized system prompts and tool sets based on conversation context. Skills are evaluated before each LLM call and the matching skill's persona is applied.

Summary

Functions

Applies a skill to the agent state by updating the active_skill and injecting the skill's system prompt into the provider.

Returns the effective tools: base tools plus active skill tools.

Evaluates all skills against the current context.

Functions

apply_skill(state, skill)

@spec apply_skill(map(), ExAgent.Skill.t()) :: map()

Applies a skill to the agent state by updating the active_skill and injecting the skill's system prompt into the provider.

effective_tools(map)

@spec effective_tools(map()) :: [ExAgent.Tool.t()]

Returns the effective tools: base tools plus active skill tools.

evaluate_skills(skills, context)

@spec evaluate_skills([ExAgent.Skill.t()], ExAgent.Context.t()) ::
  ExAgent.Skill.t() | nil

Evaluates all skills against the current context.

Returns the first skill whose activation_fn returns true, or nil if no skill matches or has an activation function.