LangChain Integration (agentskills-langchain)¶
Exposes skills as LangChain tools.
pip install agentskills-langchain
agentskills_langchain ¶
LangChain integration for Agent Skills.
This package bridges :mod:agentskills_core and LangChain
<https://python.langchain.com>_, providing:
- :func:
get_tools-- generates five :class:~langchain_core.tools.StructuredToolinstances that let an LLM agent consume skills. - :func:
get_tools_usage_instructions-- returns agent-facing instructions explaining how to use the tools.
Install::
pip install agentskills-langchain
get_tools ¶
get_tools(registry: SkillRegistry, *, max_inline_binary_bytes: int = DEFAULT_MAX_INLINE_BINARY_BYTES, fast_path: FastPath | None = None, vision: bool = False, max_inline_image_bytes: int = DEFAULT_MAX_INLINE_IMAGE_BYTES) -> list[StructuredTool]
Build LangChain tools that expose an Agent Skills registry.
Each tool wraps a :class:~agentskills_core.SkillRegistry or
:class:~agentskills_core.Skill method, serialising the result
as JSON (for dicts) or plain text (for content bodies).
Tools are read-only -- they retrieve content but never execute
scripts or modify state.
Skill discovery is handled via the catalog in the system prompt,
so no list_skills tool is included.
All tools are async coroutines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
SkillRegistry
|
The :class: |
required |
max_inline_binary_bytes
|
int
|
Size ceiling for inlining binary
resources as base64. Larger resources are described but
not returned. See
:func: |
DEFAULT_MAX_INLINE_BINARY_BYTES
|
fast_path
|
FastPath | None
|
A :class: |
None
|
vision
|
bool
|
When |
False
|
max_inline_image_bytes
|
int
|
Size ceiling for native images. Only
consulted when |
DEFAULT_MAX_INLINE_IMAGE_BYTES
|
Returns:
| Type | Description |
|---|---|
list[StructuredTool]
|
A list of :class: |
list[StructuredTool]
|
instances ready to be passed to a LangChain agent. |
get_tools_usage_instructions ¶
get_tools_usage_instructions() -> str
Return agent instructions for using the Agent Skills tools.
This text explains to an LLM agent how to use the skill
tools (get_skill_metadata, get_skill_body,
get_skill_reference, get_skill_script, get_skill_asset)
following the progressive-disclosure workflow.
Combine with the skill catalog produced by
:meth:SkillRegistry.get_skills_catalog to give the agent both
what skills are available and how to interact with them::
catalog = await registry.get_skills_catalog(format="xml")
instructions = get_tools_usage_instructions()
system_prompt = f"{catalog}\n\n{instructions}"
Returns:
| Type | Description |
|---|---|
str
|
A multi-line instruction string ready for system-prompt |
str
|
insertion. |