Skip to main content

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 newer. Installs agentskills-core and langchain-core as dependencies.

Usage

from pathlib import Path

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
list_skill_resources skill_id List bundled references, scripts and assets
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).

list_skill_resources returns a JSON object keyed by resource kind. Not every backend can enumerate resources — a plain static HTTP host cannot. Rather than surfacing an exception, the tool returns {"supported": false, "note": "..."} in that case: "this cannot be listed" is something the model can act on by falling back to the names in the skill body, not an error worth retrying.

API

get_tools(registry: SkillRegistry, *, max_inline_binary_bytes: int = 65536) -> 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).

Binary Resources

Skill resources may be arbitrary files. Valid UTF-8 is returned as-is; anything else is returned as a JSON envelope, so a binary payload is never silently mangled into replacement characters:

{
  "name": "architecture.png",
  "media_type": "image/png",
  "size_bytes": 20481,
  "encoding": "base64",
  "content": "iVBORw0KGgo..."
}

Base64 costs roughly 1.37 characters per byte, so binaries above 64 KiB are described rather than inlined - "encoding": "none" plus a note explaining the omission. Adjust the ceiling with:

tools = get_tools(registry, max_inline_binary_bytes=256 * 1024)

License

MIT

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.3.0.tar.gz (5.2 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.3.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentskills_langchain-0.3.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentskills_langchain-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7b9c45db1763008edcf51fc9365d655f3717bdb78d369aa37136f0603d2e52d2
MD5 f4a0c7dc5963a939f68f52bfcd42564f
BLAKE2b-256 6135595ab55c5da17a947146408939cc1ec8f960ae8054f47d83b5e82eec4a94

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentskills_langchain-0.3.0.tar.gz:

Publisher: publish.yml on pratikxpanda/agentskills-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for agentskills_langchain-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 046217e5224c4b3c78859fe5b2266f1046c92995ee25608237cb7708428131a6
MD5 7bfd789120a06d82397b59083e4c236a
BLAKE2b-256 d71f019da71561472c90443689b378c373510ab6c7fda3e2ea7fcb3fa9798d22

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentskills_langchain-0.3.0-py3-none-any.whl:

Publisher: publish.yml on pratikxpanda/agentskills-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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