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.1.tar.gz (12.6 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.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_skilllite-0.1.1.tar.gz
  • Upload date:
  • Size: 12.6 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.1.tar.gz
Algorithm Hash digest
SHA256 43eb8554f43133823656c1c3949d1e7d5d84cfef3bc327e7390bd36bdfa134f8
MD5 9372997e4a00208e402c73a0abc8beec
BLAKE2b-256 dd2763289d7208dbe578db3416418377ccace9bcc87550805afe1d0309ad2489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_skilllite-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52ed7342516f7f9c12ef9dd494cc35fafdd39c95e215168a1d371d026b75aaf1
MD5 eee67557f44bd2d03b34d43f0b17d5a3
BLAKE2b-256 1a5e896f9baa911731f0e7a28a2767d0825e44492fbb03708fc3b17680c396cc

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