Code execution
Code execution runs a script in an environment provisioned for the task. The harness supplies the input, controls the resources available to the script, and collects its result.
Define the execution boundary
Section titled “Define the execution boundary”Inputs, compute, and permissions
Section titled “Inputs, compute, and permissions”Use an explicit runtime entry point for bundled code. For packaged hooks, Gabriel provisions a fresh, verified E2B Studio computer with Node.js 22 or newer, passes a declared projection over standard input, disables outbound networking, and runs without workspace credentials or a connector broker. The hook can validate data and report success or failure.
Example input check
Section titled “Example input check”Put this script at scripts/check-input.mjs and invoke it in the packaged BeforeTask declaration. The example expects a required from field in the input projection.
import { readFileSync } from 'node:fs';
const { input } = JSON.parse(readFileSync(0, 'utf8'));if (typeof input?.from !== 'string' || Number.isNaN(Date.parse(input.from))) { process.stderr.write('A valid start date is required.\n'); process.exitCode = 1;}Record the outcome
Section titled “Record the outcome”A nonzero exit stops progression. Treat inability to verify compute as a setup issue and a lost or uncertain invocation as a review issue. Code execution limits which data and capabilities a program can use. Rehearsal separately demonstrates how a proposed action behaves under a test binding before review.
See the hook declaration, sandbox rehearsal, and package installation, and Standard Agent Specification’s isolated code execution.