Skip to content

pydeno

A JS sandbox for AI agents

PyPI

pydeno (python + deno) is a Python-embeddable JavaScript sandbox built on deno_core and the V8 engine. Run untrusted, LLM-generated JavaScript safely from Python โ€” real V8, real isolation, real tool-calling.

Whether you need to run user scripts, integrate JavaScript libraries, execute code for AI agents, or build extensible Python applications, pydeno provides a robust solution.

Highlights

  • ๐Ÿš€ Fast: Powered by V8, the JavaScript engine used in Chrome and Node.js
  • ๐Ÿ”Œ Extensible: Bind Python functions and objects to JavaScript
  • โšก Async First: Support JavaScript Promises and async function in Python asyncio
  • ๐Ÿ”’ Isolated Sandbox: Runtime is a V8 isolate that has no I/O access by default
  • ๐ŸŽ›๏ธ Resource Controls: Prevent abuse by setting per-runtime heap memory limits and execution timeouts
  • ๐Ÿงต Parallelism: Run multiple runtimes in parallel on different Python threads
  • ๐Ÿ“ฆ Module Support: ES modules with custom loaders and resolvers
  • โš™๏ธ WebAssembly: Execute WebAssembly (WASM) directly in native runtime
  • ๐ŸŽฏ Typing: Comprehensive type hints for PyO3 bindings

Quick Example

import pydeno

result = pydeno.eval("2 + 2")
print(result)  # 4

# Bind Python function
pydeno.bind_function("add", lambda a, b: a + b)
print(pydeno.eval("add(2, 3)"))  # 5

About the Name

pydeno is python + deno: the deno_core JavaScript engine, wrapped in Rust and bolted onto Python via PyO3.

Next Steps

  • Quick Start - Get up and running with essential features
  • Core Concepts - Understand the runtime architecture and execution model
  • Type Conversion - Learn how data types map between Python and JavaScript
  • Use Cases - Explore practical examples and real-world applications
  • API Reference - Comprehensive API documentation for all classes and functions