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 limitssplit_frontmatter() rejects YAML frontmatter blocks exceeding 256 KB (MAX_FRONTMATTER_BYTES) to prevent memory-exhaustion attacks.
  • Metadata validationvalidate_skill() checks types of known optional fields (license, compatibility, metadata, allowed-tools) and logs warnings for unknown top-level metadata keys.
  • Safe XML generationget_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.1.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.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentskills_core-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ab0b2c0814c4d24cffbc2312ff9ed4337ebe8ff315fe9d7cd6d4dad326bb1407
MD5 19f24bb1e45cc33fefb130a87c43a016
BLAKE2b-256 0d7bfabe4c93e2d8754e0a8d8d335ef45533c1220d7d5896c04a92b04343e847

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentskills_core-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc57deedbb2fdcc078089ca8b3e5e43086d9fd36c80344560e199542e4916d41
MD5 9f385c89465b9621cc6bd4db3da47b0d
BLAKE2b-256 448e89046282264da48577ce79957a10ee9f170c4563f34e1514ea707a77d63e

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