AST Validation
Block dangerous constructs before execution using ast-guard’s AgentScript preset
Code Transformation
Automatically transform code for safe execution with proxied functions and loop limits
Runtime Sandboxing
Execute in isolated Node.js vm context with controlled globals and resource limits
When to Use Enclave
Enclave is designed for scenarios where you need to execute JavaScript code from untrusted sources:- LLM-generated code - Execute code written by AI models safely
- User-provided scripts - Run user scripts in a controlled environment
- Plugin/extension systems - Allow third-party code to run securely
- Workflow automation - Execute orchestration logic with tool access
Installation
Quick Start
Execution Results
Enclave returns a structured result with success/error status and execution stats:Error Codes
| Code | Meaning | Action |
|---|---|---|
VALIDATION_ERROR | AST validation failed | Fix the code - blocked construct used |
EXECUTION_ERROR | Runtime error in script | Fix script logic |
TIMEOUT | Execution exceeded timeout | Optimize or increase timeout |
TOOL_ERROR | Tool call failed | Check tool input/availability |
MEMORY_LIMIT_EXCEEDED | Memory limit exceeded | Reduce memory usage or increase limit |
Related
- Security Levels - Pre-configured security profiles
- Tool System - Integrating tools with enclave
- Configuration - All configuration options
- ast-guard - AST validation library