Skip to content

Manager and configuration

api

Async application facade for Skill lifecycle management.

SkillManager

SkillManager(
    *,
    sources: Iterable[SkillSource] = (),
    registry: SkillRegistry | None = None,
    discovery: DiscoveryProvider | None = None,
    validator: SkillValidator | None = None,
    config: SkillManagerConfig | None = None,
    feedback_manager: FeedbackManager | None = None,
    mcp_runtime: MCPRuntime | None = None,
    refresh_engine: RefreshEngine | None = None,
    xai_runtime: XAIRuntime | None = None,
    observability_sink: SkillObservabilitySink
    | None = None,
)

Manage the Skill lifecycle and hand resolved Skills to any agent framework.

The manager validates, stores, discovers, governs and composes Skills. It never executes a Skill or runs an agent, so it works with LangGraph, CrewAI, Agno or plain Python alike. Every collaborator is an injected, fully built instance, so each downstream package keeps all of its own options.

Use it as an async context manager, or call aclose when done:

async with SkillManager(sources=[FilesystemSkillSource("skills")]) as manager:
    skill = await manager.load("summarize-ticket")

Parameters:

Name Type Description Default
sources Iterable[SkillSource]

Skill sources; the first is the default write target.

()
registry SkillRegistry | None

Catalog; defaults to InMemorySkillRegistry.

None
discovery DiscoveryProvider | None

Discovery provider; defaults to an in-memory RetrievalLoomDiscoveryProvider that the manager owns and closes.

None
validator SkillValidator | None

Policy validator; defaults to DefaultSkillValidator.

None
config SkillManagerConfig | None

Policy switches and limits.

None
feedback_manager FeedbackManager | None

Records approvals and rejections; defaults to an in-memory FeedbackManager that the manager owns and closes.

None
mcp_runtime MCPRuntime | None

Resolves required MCP capabilities in build_bundle.

None
refresh_engine RefreshEngine | None

Refreshed before sources are reloaded in refresh.

None
xai_runtime XAIRuntime | None

Receives evidence and decisions for generation, approval, rejection and bundle composition.

None
observability_sink SkillObservabilitySink | None

Receives sanitized lifecycle events.

None

Raises:

Type Description
ValueError

If two sources share a source_id.

source_errors property
source_errors: Mapping[str, str]

Return the latest per-source and per-document load errors.

observability_errors property
observability_errors: tuple[Exception, ...]

Return recent sink and XAI failures that did not interrupt Skill operations.

__aenter__ async
__aenter__() -> Self

Return the manager.

__aexit__ async
__aexit__(
    exc_type: type[BaseException] | None,
    exc: BaseException | None,
    traceback: TracebackType | None,
) -> None

Close the manager.

load async
load(
    name_or_skill_id: str, *, version: str | None = None
) -> Skill

Return a Skill by immutable ID, or the active Skill with a name and optional version.

Raises:

Type Description
SkillNotFoundError

If no Skill matches.

SkillSourceError

If nothing matches and a source failed to load, so the Skill may exist in the unreadable source.

discover async
discover(
    query: str,
    *,
    top_k: int = 5,
    filters: Mapping[str, Any] | None = None,
) -> list[Skill]

Return at most top_k active Skills ranked for query.

Parameters:

Name Type Description Default
query str

Natural-language task description.

required
top_k int

Maximum number of Skills.

5
filters Mapping[str, Any] | None

Exact name, version, tag or capability filters.

None
register_skill async
register_skill(
    skill: Skill, *, source_id: str | None = None
) -> Skill

Validate, govern, register and persist one Skill revision.

Agent Skills are held in PENDING_APPROVAL when human approval is required; pending revisions stay in the registry until they are approved.

Parameters:

Name Type Description Default
skill Skill

The revision to register.

required
source_id str | None

Source to persist to; defaults to the first source.

None

Returns:

Type Description
Skill

The registered Skill, with its governed lifecycle state.

Raises:

Type Description
SkillCreationDisabledError

If agent Skills are disabled.

SkillGovernanceError

If an agent Skill bypasses policy.

SkillValidationError

If the validator rejects the Skill.

SkillConflictError

If the revision conflicts with the catalog.

SkillSourceError

If persistence fails.

generate_skill async
generate_skill(
    generator: SkillGenerator,
    input: Any,
    *,
    parent_skill_id: str | None = None,
    source_id: str | None = None,
) -> Skill

Generate, govern and register an agent Skill.

With parent_skill_id, the generator also receives the parent revision and its recorded rejections, and the result becomes the next revision in the parent's lineage.

Parameters:

Name Type Description Default
generator SkillGenerator

Produces the candidate Skill.

required
input Any

Task description passed to the generator.

required
parent_skill_id str | None

Rejected revision to improve.

None
source_id str | None

Source to persist to; defaults to the first source.

None

Raises:

Type Description
SkillCreationDisabledError

If agent Skills are disabled.

SkillGenerationError

If the generator cannot produce a Skill.

approve_skill async
approve_skill(
    skill_id: str,
    *,
    reviewer: str | None = None,
    reason: str | None = None,
    metadata: Mapping[str, Any] | None = None,
) -> Skill

Record a human approval and activate a PENDING_APPROVAL Skill.

The approval is submitted to feedback-manager, the active revision is persisted, and only then is the feedback event resolved. If resolving fails, the Skill is returned to PENDING_APPROVAL.

Raises:

Type Description
SkillLifecycleError

If the Skill is not pending.

SkillGovernanceError

If metadata contains credential-like keys.

SkillApprovalError

If feedback or persistence fails.

reject_skill async
reject_skill(
    skill_id: str,
    *,
    feedback: str,
    reviewer: str | None = None,
    metadata: Mapping[str, Any] | None = None,
) -> Skill

Record a human rejection and retain the REJECTED revision for audit.

The feedback text is later passed to a SkillGenerator through generate_skill with parent_skill_id.

Raises:

Type Description
SkillLifecycleError

If the Skill is not pending.

SkillRejectionError

If feedback is empty, or feedback or persistence fails.

list_skills async
list_skills(
    *,
    states: Iterable[SkillLifecycleState] | None = None,
    origins: Iterable[SkillOrigin] | None = None,
) -> tuple[Skill, ...]

Return registered revisions, optionally filtered by lifecycle state and origin.

list_pending_skills async
list_pending_skills() -> tuple[Skill, ...]

Return the review queue: every PENDING_APPROVAL revision.

remove_skill async
remove_skill(skill_id: str) -> None

Delete a non-rejected revision from its source and the catalog.

Raises:

Type Description
SkillLifecycleError

If the Skill is REJECTED; rejections are kept for audit.

build_bundle async
build_bundle(skills: Iterable[Skill | str]) -> SkillBundle

Resolve dependencies and MCP capabilities into a SkillBundle.

Parameters:

Name Type Description Default
skills Iterable[Skill | str]

Root Skills, or their IDs or names.

required

Raises:

Type Description
SkillBundleError

If no root is given, a root is not ACTIVE, or two Skills define the same prompt key differently.

SkillDependencyError

If a dependency cannot be resolved.

CapabilityResolutionError

If a required capability is unavailable.

refresh async
refresh(
    *,
    mode: RefreshMode | None = None,
    resource_ids: str | Iterable[str] = (),
    selector: ResourceSelector | None = None,
    trigger: TriggerSource = MANUAL,
    metadata: Mapping[str, Any] | None = None,
    correlation_id: str | None = None,
) -> RefreshResult | None

Run the refresh engine, if any, then reload every Skill source.

All arguments are passed to RefreshEngine.refresh. Healthy sources are committed even when another source fails.

Returns:

Type Description
RefreshResult | None

The refresh-engine result, or None without a refresh engine.

Raises:

Type Description
SkillSourceError

If the refresh engine fails or any source fails.

schedule_refresh async
schedule_refresh(
    interval: float,
    *,
    run_immediately: bool = False,
    events: EventPublisher | None = None,
) -> AsyncScheduler

Start a refresh-engine AsyncScheduler that calls refresh every interval seconds.

The manager owns the scheduler and stops it in aclose.

Raises:

Type Description
SkillGovernanceError

If a scheduler is already running.

aclose async
aclose() -> None

Stop the owned scheduler and close the owned feedback manager and discovery provider.

Injected collaborators stay open; their owner closes them.

config

Immutable Skill Manager policy and limit configuration.

SkillManagerConfig pydantic-model

Bases: BaseModel

Policy switches and resource limits for one SkillManager.

Attributes:

Name Type Description
allow_agent_skill_creation bool

Accept agent-generated Skills at all.

require_human_approval bool

Hold agent-generated Skills in PENDING_APPROVAL until a reviewer approves them.

max_document_bytes int

Largest Skill YAML document a source may supply.

capability_candidate_limit int

Candidates requested from MCPRuntime.retrieve per required capability name.

capability_cache_size int

Resolved capabilities kept between bundle builds.

feedback_context_limit int

Rejection events passed to a SkillGenerator when it revises a parent Skill.

error_history_size int

Observability and XAI failures retained on SkillManager.observability_errors.

Config:

  • frozen: True
  • extra: forbid

Fields:

  • allow_agent_skill_creation (bool)
  • require_human_approval (bool)
  • max_document_bytes (int)
  • capability_candidate_limit (int)
  • capability_cache_size (int)
  • feedback_context_limit (int)
  • error_history_size (int)