Jido.AI.Skill.Prompt (Jido AI v2.2.0)

Copy Markdown View Source

Renders skills into prompt text for agent system prompts.

Provides utilities to format skill manifests and bodies into structured text that can be prepended/appended to agent prompts.

Summary

Functions

Collects all allowed tools from a list of skills.

Filters a list of tool modules by the allowed tools from skills.

Renders a list of skills into a formatted prompt section.

Renders a single skill into formatted prompt text.

Functions

collect_allowed_tools(skills)

@spec collect_allowed_tools([module() | Jido.AI.Skill.Spec.t() | String.t()]) :: [
  String.t()
]

Collects all allowed tools from a list of skills.

Returns the union of all allowed_tools from the given skills.

filter_tools(tools, skills)

@spec filter_tools([module()], [module() | Jido.AI.Skill.Spec.t() | String.t()]) :: [
  module()
]

Filters a list of tool modules by the allowed tools from skills.

Returns only the tools whose names match the union of allowed_tools from the given skills. If no skills specify allowed_tools, returns all tools.

render(skills, opts \\ [])

@spec render(
  [module() | Jido.AI.Skill.Spec.t() | String.t()],
  keyword()
) :: String.t()

Renders a list of skills into a formatted prompt section.

Options

  • :include_body - Include skill body content (default: true)
  • :header - Custom header text (default: "You have access to the following skills:")

Example

skills = [MyApp.Skills.Calculator, "code-review"]
Skill.Prompt.render(skills)
# => "You have access to the following skills:\n\n## calculator\n..."

render_one(skill, opts \\ [])

@spec render_one(
  module() | Jido.AI.Skill.Spec.t() | String.t(),
  keyword()
) :: String.t()

Renders a single skill into formatted prompt text.