LangChain integration for SkillLite - Lightweight sandboxed Python skill execution engine
Project description
langchain-skilllite
LangChain integration for SkillLite - a lightweight sandboxed Python skill execution engine.
Features
- 🔒 Sandboxed Execution - All skills run in a Rust-based sandbox (skillbox)
- 📝 Declarative Skills - Define skills via SKILL.md, no Python wrappers needed
- 🔍 Security Scanning - Pre-execution code analysis for dangerous operations
- ✅ Confirmation Callbacks - User approval for high-severity security issues
- ⚡ Async Support - Full async support for LangGraph agents
Installation
pip install langchain-skilllite
This will also install the required dependencies:
langchain-core>=0.3.0skilllite>=0.1.1
Quick Start
from langchain_skilllite import SkillLiteToolkit
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
# Load all skills from a directory as LangChain tools
tools = SkillLiteToolkit.from_directory("./skills")
# Create a LangGraph agent
agent = create_react_agent(ChatOpenAI(model="gpt-4"), tools)
# Run the agent
result = agent.invoke({
"messages": [("user", "Calculate 15 + 27 using the calculator skill")]
})
Usage
Basic Usage with SkillManager
from skilllite import SkillManager
from langchain_skilllite import SkillLiteToolkit
# Create a SkillManager
manager = SkillManager(skills_dir="./skills")
# Convert all skills to LangChain tools
tools = SkillLiteToolkit.from_manager(manager)
# Or select specific skills
tools = SkillLiteToolkit.from_manager(
manager,
skill_names=["calculator", "web_search"],
allow_network=True,
timeout=60
)
Security Levels
SkillLite supports three sandbox security levels:
| Level | Description |
|---|---|
| 1 | No sandbox - direct execution (fastest, least secure) |
| 2 | Sandbox isolation only |
| 3 | Sandbox + security scanning (default, most secure) |
# Level 3 with confirmation callback for high-severity issues
def confirm_execution(report: str, scan_id: str) -> bool:
print(report)
return input("Proceed? [y/N]: ").lower() == 'y'
tools = SkillLiteToolkit.from_directory(
"./skills",
sandbox_level=3,
confirmation_callback=confirm_execution
)
Async Confirmation (for LangGraph)
import asyncio
async def async_confirm(report: str, scan_id: str) -> bool:
print(report)
# In a real app, this might be a UI prompt
return True
tools = SkillLiteToolkit.from_directory(
"./skills",
sandbox_level=3,
async_confirmation_callback=async_confirm
)
Callback Handler for Monitoring
from langchain_skilllite import SkillLiteCallbackHandler
handler = SkillLiteCallbackHandler(verbose=True)
# Use with agent
result = agent.invoke(
{"messages": [("user", "Run my skill")]},
config={"callbacks": [handler]}
)
# Get execution summary
print(handler.get_execution_summary())
API Reference
SkillLiteTool
LangChain BaseTool adapter for a single SkillLite skill.
SkillLiteToolkit
Factory class for creating multiple SkillLiteTool instances.
from_manager(manager, ...)- Create tools from a SkillManagerfrom_directory(skills_dir, ...)- Create tools from a skills directory
SkillLiteCallbackHandler
LangChain callback handler for monitoring skill execution.
Requirements
- Python >= 3.9
- langchain-core >= 0.3.0
- skilllite >= 0.1.1
License
MIT License - see LICENSE for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_skilllite-0.1.3.tar.gz.
File metadata
- Download URL: langchain_skilllite-0.1.3.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e73729109570d7f5240c10ddc7b02fff2c1a71d87d4bb4a73b62dba2d9356fef
|
|
| MD5 |
aab4663539790156bceff2a76ce75920
|
|
| BLAKE2b-256 |
6b4929cbfeefa29f3c57fe7f10aed2e1f6df629a2b54ab791d1c28e65c6493f3
|
File details
Details for the file langchain_skilllite-0.1.3-py3-none-any.whl.
File metadata
- Download URL: langchain_skilllite-0.1.3-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b26f179ee034db4d4a2b748b80c5cbf126c9166782aa16c23f65c4482bafbba0
|
|
| MD5 |
13e3a58290e6a4def1e73d291de84644
|
|
| BLAKE2b-256 |
0abc04f7c1be32b125a564cf23a623bfaccc89c30de73d2e68544b9867601248
|