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+ 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+.

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.2.tar.gz (9.8 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.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentskills_core-0.2.2.tar.gz
  • Upload date:
  • Size: 9.8 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.2.tar.gz
Algorithm Hash digest
SHA256 a81431c2ecfefb6d28c7e17270e17d0b7a16efb8931d4704e17350a56692f6c2
MD5 d2d30aaaa1e2a912ecfd4fa043328860
BLAKE2b-256 51fa56b035e3dd58b33cd3c7e8de06e1687cf257a021bd2e67d8da0b2850fd14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentskills_core-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b86203e1ba45907ef06cd2efb99badbecb65caaeb0c64ac0ce1705aa3a837c40
MD5 5603b36608b52e2d8b8f1de3936fdfbc
BLAKE2b-256 850b6f55eaf97bad4dbe2d4018bc807d573920ccea1e2d4e368cda17ebd2c1bd

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