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

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: langchain_capsule-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3e88ba89de26a4b5a1d690f1400e7dbb5b85a492892a33b2da0311f51827c368
MD5 c24042c933cb50909f12e6da282cdb98
BLAKE2b-256 844322a99b3c5c5c1a82cf44e6e6d5b0b66d08a1c1a4db931cec9f1fd0f9cdb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_capsule-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bd88e68c5bb720e73f2d7714d4b5ebe2a8376cb95be5dbb95bb14906ea373106
MD5 c375dafbe492a2eee09a07777fe94bed
BLAKE2b-256 0224eecfcb240f30a629bdb8a0b0dbc1f8589e5f38b9072aec2cd6f59e1658d6

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