services.skills_area
Server-side skills area.
Maintains the lifecycle state for each skill known to the agent runtime. Skills go through three states:
- available: in catalog, not yet enabled.
- enabled: user toggled it on; SKILL.md loading still pending.
- loaded: the full SKILL.md definition has been loaded and the skill is included in the LLM system prompt.
Only loaded skills are injected into the system prompt. The WS
agent.snapshot pushes the full skills list with per-skill status so the
frontend never needs a REST endpoint.
SkillEntry Objects
class SkillEntry(BaseModel)
A single skill tracked by the skills area.
SkillsArea Objects
class SkillsArea()
Manages the runtime-global skills lifecycle used by monitoring and prompt composition.
Notes
This object is process-global in the current implementation (singleton). It does not provide explicit cross-thread synchronization.
strip_version
@staticmethod
def strip_version(skill_ref: str) -> str
Strip an optional version suffix like crawl:0.0.1 → crawl.
The agent spec and frontend may use version-qualified references
(<name>:<semver>) while the filesystem skills use plain names.
list_skills
def list_skills() -> list[SkillEntry]
Return all tracked skills.
get_skills_for_prompt
def get_skills_for_prompt() -> list[SkillEntry]
Return only loaded skills (SKILL.md loaded, in system prompt).
Lazily triggers loading of any enabled-but-not-yet-loaded skills
so the first inference call promotes them to loaded.
seed_available
def seed_available(skills_info: list[dict[str, Any]]) -> None
Seed skills from discovery (folder scan / catalog).
Only adds skills that are not already tracked, preserving existing status for skills that were already enabled/loaded.
enable_skill
def enable_skill(skill_id: str) -> SkillEntry | None
Enable a skill. If not yet tracked, creates an entry.
Returns the updated entry, or None if the skill was already loaded (no state change needed).
disable_skill
def disable_skill(skill_id: str) -> SkillEntry | None
Disable a skill (move back to available).
mark_loaded
def mark_loaded(skill_id: str,
skill_definition: str,
prompt_section: str,
*,
name: str | None = None,
description: str | None = None,
tags: list[str] | None = None,
has_scripts: bool | None = None,
has_resources: bool | None = None,
source_variant: str | None = None,
module: str | None = None,
package: str | None = None,
method: str | None = None,
path: str | None = None) -> SkillEntry
Mark a skill as loaded (SKILL.md loaded, in system prompt).
build_prompt_section
def build_prompt_section() -> str
Build the combined system prompt section for all active skills.
to_snapshot_list
def to_snapshot_list() -> list[dict[str, Any]]
Serialize all skills for the WS snapshot payload.
load_skill
def load_skill(skill_id: str, skills_path: str | None = None) -> bool
Load a skill via agent-skills and mark it as loaded.
Returns True if the skill was successfully loaded, False otherwise.
load_all_enabled
def load_all_enabled(skills_path: str | None = None) -> int
Load all enabled-but-not-yet-loaded skills.
Returns the number of skills that were successfully loaded.