Metadata-Version: 2.4
Name: langchain-skills-adapter
Version: 0.1.2
Summary: Anthropic Agent Skills implementation for LangChain
Project-URL: Homepage, https://github.com/29swastik/langchain-skills-adapter
Project-URL: Repository, https://github.com/29swastik/langchain-skills-adapter
Project-URL: Documentation, https://github.com/29swastik/langchain-skills-adapter#readme
Project-URL: Issues, https://github.com/29swastik/langchain-skills-adapter/issues
Author-email: Swastik Krishnamurthy <kswastik29@gmail.com>
License: MIT
License-File: LICENSE
Keywords: agent-skills,ai-agents,anthropic,langchain,llm
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: <4.0.0,>=3.10
Requires-Dist: langchain-core<2.0.0,>=1.0.1
Requires-Dist: langchain-experimental>=0.4.1
Requires-Dist: langchain>=1.2.8
Requires-Dist: pydantic<3.0.0,>=2.0.0
Requires-Dist: pyyaml<7.0.0,>=5.3.0
Requires-Dist: typing-extensions>=4.5.0
Provides-Extra: dev
Requires-Dist: langchain-openai>=1.1.7; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio<1.0.0,>=0.20.3; extra == 'dev'
Requires-Dist: pytest-cov<7.0.0,>=6.2.1; extra == 'dev'
Requires-Dist: pytest<9.0.0,>=8.4.1; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# LangChain Skills Adapter
This package provides an easy way to work with Agent Skills in your LangChain/LangGraph project by treating Skills as any other tool in LangChain, allowing you to easily integrate skills with existing workflows and agents. For developers, Skills work like any other LangChain tool.

![alt text](image.png)

## Installation

Install from PyPI:

```bash
pip install langchain-skills-adapter
```

## Create SkillTool
SkillTool accepts 2 arguments: `directories` (required) and `description_template` (optional).

### Supported Directory Structures:

Scenario 1 - Direct skill directory:
```
skills/
└── pdf/
    └── SKILL.md
```
Usage: `SkillTool(directories="skills/pdf")`

Scenario 2 - Parent directory with multiple skills:
```
.copilot/skills/
├── pdf/
│   └── SKILL.md
├── pptx/
│   └── SKILL.md 
└── excel/
    └── SKILL.md
```
Usage: `SkillTool(directories=".copilot/skills")`  # Discovers all three skills

Scenario 3 - Nested skill directories:
```
skills/
├── documents/
│   ├── pdf/
│   │   └── SKILL.md
│   └── word/
│       └── SKILL.md 
└── data/
    └── csv/
        └── SKILL.md
```
Usage: `SkillTool(directories="skills")`  # Recursively discovers all nested skills

Scenario 4 - Multiple parent directories:
```
~/.agents/skills/
└── pdf/
    └── SKILL.md

./custom-skills/
└── excel/
    └── SKILL.md
```
Usage: `SkillTool(directories=["~/.agents/skills", "./custom-skills"])`

```py
from langchain_skills import SkillTool

# Load skills from a directory
skill_tool = SkillTool(directories=".agent/skills/")
```

## Example Usage
```py
from langchain.agents import create_agent
from langchain_community.agent_toolkits import FileManagementToolkit
from langchain_community.tools import ShellTool
from langchain_skills import SkillTool

# create skill tool
skill_tool = SkillTool(directories=".agent/skills/")

# Create supporting tools to complement the skill
file_management_toolkit = FileManagementToolkit(root_dir='..').get_tools()
bash_tool = ShellTool()

# Combine all tools
tools = file_management_toolkit + [bash_tool, skill_tool]

agent = create_agent(model, tools)
```

It is highly recommended to provide FileManagementToolkit and ShellTool, which act as supporting tools in case your skill is not just a SKILL.md file. Even if the skill is a simple single SKILL.md file, it depends on what is actually written in that SKILL.md file. It depends on your use case.


# Important:
Since this setup makes use of FileSystemTools and ShellTool, ensure proper security and safety measures. This is not the responsibility of this library.

## Inspiration
This work is inspired by Spring AI's SkillTool implementation:  
https://github.com/spring-ai-community/spring-ai-agent-utils/blob/main/spring-ai-agent-utils/src/main/java/org/springaicommunity/agent/tools/SkillsTool.java

