Skip to main content

Storage-agnostic abstractions for discovering, validating, and accessing Agent Skills (https://agentskills.io)

Project description

agentskills-core

PyPI Python 3.12 | 3.13 License: MIT

Core abstractions for the Agent Skills SDK - provider interface, registry, validation, and skill model.

This package provides the foundational building blocks for working with the Agent Skills format. It is storage-agnostic - concrete providers (filesystem, HTTP, database, etc.) live in separate packages.

Installation

pip install agentskills-core

Requires Python 3.12 or 3.13.

What's Included

Export Description
SkillProvider Abstract base class that every skill backend must implement
Skill Lightweight runtime handle to a single registered skill
SkillRegistry Unified index with explicit registration and catalog builder
validate_skill Validates a skill against the Agent Skills specification
split_frontmatter Parses YAML frontmatter from SKILL.md content
AgentSkillsError Base exception for all library errors
SkillNotFoundError Raised when a skill does not exist
ResourceNotFoundError Raised when a resource within a skill does not exist

Usage

Registering Skills

from agentskills_core import SkillRegistry

registry = SkillRegistry()
await registry.register("incident-response", provider)  # validates on registration

Or register multiple skills at once:

await registry.register([
    ("incident-response", fs_provider),
    ("api-style-guide", http_provider),
])

Batch registration is atomic - if any skill fails validation, none are registered.

Accessing Skills

skill = registry.get_skill("incident-response")
meta = await skill.get_metadata()       # YAML frontmatter as dict
body = await skill.get_body()           # Markdown instructions
script = await skill.get_script("run.sh")

Building a Catalog

Generate a catalog string for system-prompt injection:

xml_catalog = await registry.get_skills_catalog(format="xml")       # <available_skills> XML
md_catalog = await registry.get_skills_catalog(format="markdown")   # Markdown list

Implementing a Custom Provider

from agentskills_core import SkillProvider

class DatabaseSkillProvider(SkillProvider):
    async def get_metadata(self, skill_id: str) -> dict: ...
    async def get_body(self, skill_id: str) -> str: ...
    async def get_script(self, skill_id: str, name: str) -> bytes: ...
    async def get_asset(self, skill_id: str, name: str) -> bytes: ...
    async def get_reference(self, skill_id: str, name: str) -> bytes: ...

All methods are async so implementations backed by network I/O can be non-blocking.

Security

  • Frontmatter size limits - split_frontmatter() rejects YAML frontmatter blocks exceeding 256 KB (MAX_FRONTMATTER_BYTES) to prevent memory-exhaustion attacks.
  • Metadata validation - validate_skill() checks types of known optional fields (license, compatibility, metadata, allowed-tools) and logs warnings for unknown top-level metadata keys.
  • Safe XML generation - get_skills_catalog(format="xml") uses xml.etree.ElementTree for catalog generation, avoiding XML injection via string concatenation.

For the full security policy, see SECURITY.md.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentskills_core-0.2.3.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentskills_core-0.2.3-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file agentskills_core-0.2.3.tar.gz.

File metadata

  • Download URL: agentskills_core-0.2.3.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.13.9 Windows/11

File hashes

Hashes for agentskills_core-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2fb5fa57cada3aeac184a3e7f37f280b1aceb8c482f1a1144647031aae77a0da
MD5 e3a2fb38afaa2278ee7a5c3cd383200a
BLAKE2b-256 ec2c96eb45eb5dee39152e6cb1999e38a492c2fe966c94a9155da9e6332047e3

See more details on using hashes here.

File details

Details for the file agentskills_core-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: agentskills_core-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.13.9 Windows/11

File hashes

Hashes for agentskills_core-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b0904cfcf4fdb91516cfa05b07674de2ef3816a65af452f07ee41a418800ce4d
MD5 d0d1edbba2eabb714c2f32f3a3b66d36
BLAKE2b-256 8d5e07a57bc40ef84a20814f09d502a30c1ccf95d40a97c039d89699ba6fff4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page