Capsule sandbox integration for LangChain — run code in isolated WebAssembly sandboxes
Project description
langchain-capsule
Capsule integration for LangChain.
What is this?
langchain-capsule gives LangChain agents the ability to safely execute Python and javascript code in an isolated WebAssembly sandbox.
The WebAssembly sandbox files (.wasm) are already bundled inside this package; no configuration or network request is necessary to execute the sandboxes dynamically.
Installation
pip install langchain-capsule
Usage
The package provides tools for executing code inside an isolated environment.
import asyncio
from langchain_capsule import CapsulePythonTool, CapsuleJSTool
# Python Example
python_tool = CapsulePythonTool()
result = python_tool.run("1 + 1")
print(result) # "2"
# JavaScript / TypeScript Example
js_tool = CapsuleJSTool()
result = asyncio.run(js_tool.arun("1 + 2"))
print(result) # "3"
More information
Visit Capsule repository for more information.
License
MIT License
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
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_capsule-0.1.1.tar.gz.
File metadata
- Download URL: langchain_capsule-0.1.1.tar.gz
- Upload date:
- Size: 20.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
052b2b67936ff9b767cd49e8c50c5bd4ba252c3f5d66aded1ea5c2620d8371ef
|
|
| MD5 |
5fc2acd3f1fe706ca857f489a55fdf40
|
|
| BLAKE2b-256 |
17e56c593c4a5f6e42688cd5a60d3ead1992a97dc74f1c122a157a9b1b8d1a7b
|
File details
Details for the file langchain_capsule-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: langchain_capsule-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 20.6 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4d391dee9542d93cf97849681ba71c7ba58b8178a6aeb8bd421233a0a9f5b6a
|
|
| MD5 |
be15c3f4758182f03e4e5b91a367c0fd
|
|
| BLAKE2b-256 |
a6889e54dc93b1c4a0e6539f3839d26198bb9c9dbbbe13c42584f5525f269cbc
|