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.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.
Basic Usage
Configuration Options
Option Reference
| Option | Type | Default | Description |
|---|---|---|---|
requireCallTool | boolean | false | Require at least one callTool() invocation in the code |
allowedGlobals | string[] | Standard safe globals | Identifiers that can be referenced without declaration |
allowArrowFunctions | boolean | true | Allow arrow functions for array methods |
allowedLoops | object | for and for-of | Configure which loop types are allowed |
additionalDisallowedIdentifiers | string[] | [] | Additional identifiers to block |
What AgentScript Blocks
| Category | Blocked Constructs | Why |
|---|---|---|
| Code execution | eval, Function, AsyncFunction, GeneratorFunction | Prevents dynamic code injection |
| System access | process, require, module, __dirname, __filename, Buffer | Prevents Node.js API access |
| Global objects | window, globalThis, global, self, this | Prevents sandbox escape |
| Timers | setTimeout, setInterval, setImmediate | Prevents timing attacks and async escape |
| Prototype | __proto__, constructor, prototype | Prevents prototype pollution |
| Metaprogramming | Proxy, Reflect | Prevents interception and reflection |
| Network | fetch, XMLHttpRequest, WebSocket | Prevents network access |
| Storage | localStorage, sessionStorage, indexedDB | Prevents data persistence |
| Native code | WebAssembly, Worker, SharedWorker | Prevents native execution |
| Weak references | WeakMap, WeakSet, WeakRef | Prevents reference manipulation |
| User functions | function foo() {}, const f = function() {} | Prevents recursion (arrow functions allowed) |
| Unbounded loops | while, do-while, for-in | Prevents infinite loops and prototype walking |
What AgentScript Allows
Default Allowed Globals
The AgentScript preset allows these globals by default:callTool- Tool invocationMath- Mathematical operationsJSON- JSON parsing/stringifyingArray- Array constructor and methodsObject- Object methodsString- String methodsNumber- Number methodsBoolean- Boolean conversionDate- Date operations (read-only)console- Logging (rate-limited by enclave)undefined,null,NaN,Infinity- Primitives
Customizing Allowed Globals
Precedence Rules
WhenallowedGlobals and additionalDisallowedIdentifiers are both provided, the following precedence applies:
allowedGlobalsremoves from the dangerous list — If an identifier likeprocessis normally blocked but you include it inallowedGlobals, it will be removed from the built-in dangerous identifiers blocklist and allowed.additionalDisallowedIdentifiersalways wins — If an identifier appears in bothallowedGlobalsandadditionalDisallowedIdentifiers, it remains blocked. This lets you grant broad access while force-blocking specific identifiers.
Loop Configuration
Control which loop types are allowed:Requiring Tool Calls
Ensure scripts actually use tools:Related
- Overview - Getting started
- Pre-Scanner - Layer 0 defense
- Security Rules - Rule reference
- Code Transform - AST transformations