Configuration

RuntimeOptions

Passed to new Runtime(root, options?).

OptionTypeDefaultDescription
readonlybooleanfalseWrap fs in a read-only adapter
overlaybooleanfalseCopy root to temp dir; use apply() to write back
limitsResourceLimitssee belowDefault timeout and output caps
filesRecord<string, string>Create files under the workspace root at construction (relative paths)
includeGlobsstring[]["**/*"]Minimatch patterns for snapshot before/after diff scope
excludeGlobsstring[]node_modules, .gitExcluded from glob matching
runLogbooleantrueRecord each run() in memory
runLogMaxEntriesnumber200Ring buffer size (oldest dropped)
onRun(entry: RunLogEntry) => voidCalled after each logged run

ResourceLimits

FieldDefault (if unset)Description
timeoutMs30000Child process timeout
maxOutputBytes2 * 1024 * 1024Truncate combined stdout+stderr; full digest in hashFull when truncated

RunOptions

Passed to runtime.run(language, code, opts?). Overrides per run:

  • timeoutMs, maxOutputBytes
  • cwd — relative to workspace (must stay inside it)
  • env — extra environment variables for the child process

Session run log

When run logging is enabled, each completed run appends a RunLogEntry (language, code, cwd, stdout, stderr, exit code, duration, file changes, truncation flag).

import { Runtime, exportRunLogJSON } from "agentpad";

const rt = new Runtime("./repo", {
  onRun: (e) => {
    if (e.stderr) console.warn(e.id, e.stderr);
  },
});

await rt.run("bash", "echo hi");
console.log(exportRunLogJSON(rt.getRunLog()));

rt.clearRunLog();

Disable entirely: { runLog: false }.

Globs

includeGlobs / excludeGlobs use minimatch with dot: true. They control which files are considered when computing RunResult.files (created / modified / deleted), not which paths engines can access on disk.