Skip to main content
Enclave is a production-ready JavaScript sandbox for executing AI-generated code safely. It provides a defense-in-depth security model, real-time streaming execution, and comprehensive tooling for building AI agent systems.

Why Enclave?

When AI agents generate code, you need to execute it safely. Enclave provides:
  • 6-Layer Security - Pre-scanning, AST validation, code transformation, AI scoring, runtime isolation, and output sanitization
  • Real-time Streaming - See execution output as it happens with tool call visualization
  • Tool Orchestration - Connect external APIs and services through a controlled interface
  • React Integration - First-class hooks and components for building code execution UIs

Get Started

Quickstart

Build your first secure code execution in 5 minutes

Installation

Install all Enclave packages for your project

Core Libraries

@enclave-vm/core

Secure JavaScript sandbox with AST validation, runtime isolation, and AI scoring gate

@enclave-vm/ast

AST-based JavaScript validator with 16 security rules and code transformation

EnclaveJS Streaming Runtime

Build real-time code execution UIs with streaming output, tool orchestration, and React integration.

@enclave-vm/broker

Tool broker with session management and HTTP API

@enclave-vm/client

Browser and Node.js client SDK

@enclave-vm/react

React hooks and components

EnclaveJS Overview

Learn about the full streaming architecture including types, protocol, and runtime deployment

Understand the System

Architecture

System overview and deployment patterns

Security Model

6-layer defense-in-depth architecture

AgentScript

Safe JavaScript subset for LLM-generated code

Streaming Protocol

NDJSON protocol with E2E encryption

Learn by Example

Build Your First Agent

Step-by-step guide to building an AI agent

Tool Integration

Connect external APIs as tools

React Code Editor

Build a real-time code execution UI

Production Deployment

Deploy Enclave to production

Key Features

FeatureDescription
Production-ready Security500+ security tests, 6 defense layers, comprehensive CVE coverage
Real-time StreamingNDJSON-based protocol for stdout, logs, and tool calls
Tool OrchestrationDefine tools with validation, handle calls during execution
React IntegrationFirst-class hooks for building interactive code execution UIs
End-to-end EncryptionOptional ECDH + AES-256-GCM for sensitive workloads
TypeScript-firstFull type safety and excellent developer experience
Multiple Isolation ModesVM sandbox, worker pool, and double-VM options
AI Scoring GateSemantic pattern detection to block suspicious code

Quick Install

# Core sandbox
npm install @enclave-vm/core

# AST validation
npm install @enclave-vm/ast

# Streaming runtime
npm install @enclave-vm/broker @enclave-vm/client @enclave-vm/react

Explore the Docs

SectionDescription
ConceptsUnderstand how Enclave works
Core LibrariesDeep dive into each package
GuidesStep-by-step tutorials
API ReferenceComplete API documentation
ExamplesCopy-paste code examples
TroubleshootingDebug issues