Skip to main content

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

langchain_capsule-0.1.3.tar.gz (20.4 MB view details)

Uploaded Source

Built Distribution

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

langchain_capsule-0.1.3-py2.py3-none-any.whl (20.5 MB view details)

Uploaded Python 2Python 3

File details

Details for the file langchain_capsule-0.1.3.tar.gz.

File metadata

  • Download URL: langchain_capsule-0.1.3.tar.gz
  • Upload date:
  • Size: 20.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_capsule-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4842e24e9a54c3a10ed39e5b41d7acab29b65e227bd1d1dbd1a5ac555bf282b9
MD5 ae2618fea698fc466660a97d39d08c60
BLAKE2b-256 184a88c51169f9d2a6c16adf2aa8a9bde2e0ddb34675671ebf83563eb2cf9f05

See more details on using hashes here.

File details

Details for the file langchain_capsule-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_capsule-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 77db0ae37c106c93e8a50fba764210023becdbe31fc2a85d17e330459415f3bc
MD5 1568cb12913207a39021d164bdad795e
BLAKE2b-256 eb6405c25767f67b62dbab90b50acf90dd99d682fca6e0d954deddd932c0fe33

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