Skip to main content

LangChain integration for the Agent Skills format (https://agentskills.io)

Project description

agentskills-langchain

PyPI Python 3.12 | 3.13 License: MIT

LangChain integration for the Agent Skills SDK - turn a skill registry into LangChain tools.

Generates a set of LangChain StructuredTool instances from a SkillRegistry, ready to be passed to any LangChain agent.

Installation

pip install agentskills-langchain

Requires Python 3.12 or 3.13. Installs agentskills-core and langchain-core as dependencies.

Usage

from agentskills_core import SkillRegistry
from agentskills_fs import LocalFileSystemSkillProvider
from agentskills_langchain import get_tools, get_tools_usage_instructions

# Set up registry
provider = LocalFileSystemSkillProvider(Path("./skills"))
registry = SkillRegistry()
await registry.register("incident-response", provider)

# Build tools + system prompt
tools = get_tools(registry)
catalog = await registry.get_skills_catalog(format="xml")
instructions = get_tools_usage_instructions()
system_prompt = f"{catalog}\n\n{instructions}"

Pass tools to your LangChain agent and inject system_prompt into the system message. The catalog tells the agent what skills exist; the usage instructions tell it how to use the tools.

Generated Tools

Tool Parameters Description
get_skill_metadata skill_id Get structured metadata (name, description, etc.)
get_skill_body skill_id Load the full markdown instructions
get_skill_reference skill_id, name Read a reference document
get_skill_script skill_id, name Read a script
get_skill_asset skill_id, name Read an asset

All tools are async-compatible (StructuredTool with coroutine).

API

get_tools(registry: SkillRegistry) -> list[StructuredTool]

Returns a list of LangChain structured tools bound to the given registry.

get_tools_usage_instructions() -> str

Returns a markdown string explaining the progressive-disclosure workflow - read metadata, then body, then fetch resources on demand. Designed for system-prompt injection alongside the skill catalog.

Example

See examples/langchain/ for a full working demo.

Error Handling

Scenario Exception
Skill not found in registry SkillNotFoundError
Resource not found in skill ResourceNotFoundError
Provider errors (HTTP, filesystem) AgentSkillsError

All exceptions inherit from AgentSkillsError (from agentskills-core).

Note: Binary content (scripts, assets, references) is decoded as UTF-8 with errors="replace". Non-decodable bytes are replaced with the Unicode replacement character (�).

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_langchain-0.2.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

agentskills_langchain-0.2.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentskills_langchain-0.2.3.tar.gz
  • Upload date:
  • Size: 4.5 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_langchain-0.2.3.tar.gz
Algorithm Hash digest
SHA256 313c3d01a6a7fab0dbeb9654034637be1eac679e56a321a69e3a45fad62533a3
MD5 20cd7ea5837db79131bd28d3b0cedd0c
BLAKE2b-256 de5317cac02d7d8740e12e82e7176aab864235c49512776fccea206b7ac266b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agentskills_langchain-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5fd613fd3425855bf13c5df375fd5c566c9b382b5ea1f4049a7fa3774d529263
MD5 93b9e07357d1d66ecb7bef5365bf53cc
BLAKE2b-256 ee5010f19a2b4b8aee8cfd81b362b8edadf33f41e35acee213717c8e9bf922f2

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