> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Welcome to Enclave

> Production ready JavaScript sandbox for AI agent code execution

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

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/enclave/getting-started/quickstart">
    Build your first secure code execution in 5 minutes
  </Card>

  <Card title="Installation" icon="download" href="/enclave/getting-started/installation">
    Install all Enclave packages for your project
  </Card>
</CardGroup>

## Core Libraries

<CardGroup cols={2}>
  <Card title="@enclave-vm/core" icon="lock" href="/enclave/core-libraries/enclave-vm/overview">
    Secure JavaScript sandbox with AST validation, runtime isolation, and AI scoring gate
  </Card>

  <Card title="@enclave-vm/ast" icon="shield-check" href="/enclave/core-libraries/ast-guard/overview">
    AST-based JavaScript validator with 16 security rules and code transformation
  </Card>
</CardGroup>

## EnclaveJS Streaming Runtime

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

<CardGroup cols={3}>
  <Card title="@enclave-vm/broker" icon="server" href="/enclave/enclavejs/broker">
    Tool broker with session management and HTTP API
  </Card>

  <Card title="@enclave-vm/client" icon="plug" href="/enclave/enclavejs/client">
    Browser and Node.js client SDK
  </Card>

  <Card title="@enclave-vm/react" icon="react" href="/enclave/enclavejs/react">
    React hooks and components
  </Card>
</CardGroup>

<Card title="EnclaveJS Overview" icon="book-open" href="/enclave/enclavejs/overview">
  Learn about the full streaming architecture including types, protocol, and runtime deployment
</Card>

## Understand the System

<CardGroup cols={2}>
  <Card title="Architecture" icon="sitemap" href="/enclave/concepts/architecture">
    System overview and deployment patterns
  </Card>

  <Card title="Security Model" icon="shield" href="/enclave/concepts/security-model">
    6-layer defense-in-depth architecture
  </Card>

  <Card title="AgentScript" icon="code" href="/enclave/concepts/agentscript">
    Safe JavaScript subset for LLM-generated code
  </Card>

  <Card title="Streaming Protocol" icon="wave-pulse" href="/enclave/concepts/streaming-protocol">
    NDJSON protocol with E2E encryption
  </Card>
</CardGroup>

## Learn by Example

<CardGroup cols={2}>
  <Card title="Build Your First Agent" icon="robot" href="/enclave/guides/first-agent">
    Step-by-step guide to building an AI agent
  </Card>

  <Card title="Tool Integration" icon="wrench" href="/enclave/guides/tool-integration">
    Connect external APIs as tools
  </Card>

  <Card title="React Code Editor" icon="window" href="/enclave/guides/react-code-editor">
    Build a real-time code execution UI
  </Card>

  <Card title="Production Deployment" icon="server" href="/enclave/guides/production-deployment">
    Deploy Enclave to production
  </Card>
</CardGroup>

## Key Features

| Feature                       | Description                                                       |
| ----------------------------- | ----------------------------------------------------------------- |
| **Production-ready Security** | 500+ security tests, 6 defense layers, comprehensive CVE coverage |
| **Real-time Streaming**       | NDJSON-based protocol for stdout, logs, and tool calls            |
| **Tool Orchestration**        | Define tools with validation, handle calls during execution       |
| **React Integration**         | First-class hooks for building interactive code execution UIs     |
| **End-to-end Encryption**     | Optional ECDH + AES-256-GCM for sensitive workloads               |
| **TypeScript-first**          | Full type safety and excellent developer experience               |
| **Multiple Isolation Modes**  | VM sandbox, worker pool, and double-VM options                    |
| **AI Scoring Gate**           | Semantic pattern detection to block suspicious code               |

## Quick Install

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
# 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

| Section                                                       | Description                  |
| ------------------------------------------------------------- | ---------------------------- |
| [Concepts](/enclave/concepts/architecture)                    | Understand how Enclave works |
| [Core Libraries](/enclave/core-libraries/enclave-vm/overview) | Deep dive into each package  |
| [Guides](/enclave/guides/first-agent)                         | Step-by-step tutorials       |
| [API Reference](/enclave/api-reference/enclave-vm)            | Complete API documentation   |
| [Examples](/enclave/examples/hello-world)                     | Copy-paste code examples     |
| [Troubleshooting](/enclave/troubleshooting/common-errors)     | Debug issues                 |

## Links

* [GitHub Repository](https://github.com/agentfront/enclave)
* [Installation Guide](/enclave/getting-started/installation)
* [Quickstart](/enclave/getting-started/quickstart)
* [API Reference](/enclave/api-reference/enclave-vm)
