Skip to main content
The AgentScript preset is purpose-built for validating LLM-generated orchestration code. It’s the default preset used by enclave-vm and provides the strictest validation for AI-generated code.

Basic Usage

Configuration Options

Option Reference

Use requireCallTool: true to ensure AgentScript code actually interacts with tools rather than just performing local computations.

What AgentScript Blocks

What AgentScript Allows

Default Allowed Globals

The AgentScript preset allows these globals by default:
  • callTool - Tool invocation
  • Math - Mathematical operations
  • JSON - JSON parsing/stringifying
  • Array - Array constructor and methods
  • Object - Object methods
  • String - String methods
  • Number - Number methods
  • Boolean - Boolean conversion
  • Date - Date operations (read-only)
  • console - Logging (rate-limited by enclave)
  • undefined, null, NaN, Infinity - Primitives

Customizing Allowed Globals

Precedence Rules

When allowedGlobals and additionalDisallowedIdentifiers are both provided, the following precedence applies:
  1. allowedGlobals removes from the dangerous list — If an identifier like process is normally blocked but you include it in allowedGlobals, it will be removed from the built-in dangerous identifiers blocklist and allowed.
  2. additionalDisallowedIdentifiers always wins — If an identifier appears in both allowedGlobals and additionalDisallowedIdentifiers, it remains blocked. This lets you grant broad access while force-blocking specific identifiers.
Be careful when adding normally-blocked identifiers like process or eval to allowedGlobals. Only do so when the sandbox runtime provides safe wrappers for these APIs.

Loop Configuration

Control which loop types are allowed:
for-in loops are blocked by default because they iterate over prototype properties, which can lead to unexpected behavior and security issues.

Requiring Tool Calls

Ensure scripts actually use tools: