Skip to main content

LangChain integration for SkillLite - Lightweight sandboxed Python skill execution engine

Project description

langchain-skilllite

PyPI version License: MIT

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.0
  • skilllite>=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 SkillManager
  • from_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_skilllite-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

langchain_skilllite-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file langchain_skilllite-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_skilllite-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for langchain_skilllite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 989dd486542712805a159e777fe562094a70e0ca56ca15cc2dcae69f8496fd0e
MD5 a78992d24084c2fd275dd847e45f5ec8
BLAKE2b-256 7a55cc5b58b79aa533ab9eb5f94e716f55d1a76404f8f8b4a3f5557fd77ea5f0

See more details on using hashes here.

File details

Details for the file langchain_skilllite-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_skilllite-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63b9f6ef50fcb01b64bc386347527f01647c92f2d172bb27694e8c94a3540b42
MD5 18b71839e7681c269f49386eed237fd8
BLAKE2b-256 029f9764017a10459f1e1c4312e83b65d48dbe7f4b5bf47f55d5204878a1510f

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