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.1.tar.gz (20.5 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.1-py2.py3-none-any.whl (20.6 MB view details)

Uploaded Python 2Python 3

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

Hashes for langchain_capsule-0.1.1.tar.gz
Algorithm Hash digest
SHA256 052b2b67936ff9b767cd49e8c50c5bd4ba252c3f5d66aded1ea5c2620d8371ef
MD5 5fc2acd3f1fe706ca857f489a55fdf40
BLAKE2b-256 17e56c593c4a5f6e42688cd5a60d3ead1992a97dc74f1c122a157a9b1b8d1a7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_capsule-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c4d391dee9542d93cf97849681ba71c7ba58b8178a6aeb8bd421233a0a9f5b6a
MD5 be15c3f4758182f03e4e5b91a367c0fd
BLAKE2b-256 a6889e54dc93b1c4a0e6539f3839d26198bb9c9dbbbe13c42584f5525f269cbc

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