Elijas
07/24/2026, 8:52 AMVaibhav (BAML π)
07/24/2026, 2:42 PMaaronv (BAML)
07/24/2026, 7:56 PMAntonio Sarosi (BAML π)
07/24/2026, 9:24 PMts
function example() {
// Allow read/write, all else forbidden.
let sb = sandbox.new(allow = [
sandbox.IoClass.FsRead,
sandbox.IoClass.FsWrite,
]);
// Block writes to any file other than the target JSON file
let write_guard = sb.wrap(baml.fs.write);
write_guard.replace((path: string, content: string) -> {
if (path != "allowed.json") {
throw baml.errors.Io {
message: "You don't have permissions to write to this file"
};
}
// Call original fs write
write_guard.super(path, content);
});
// Run agent code in the sandbox
let result = sb.run(() -> {
// Agent code
});
}Antonio Sarosi (BAML π)
07/24/2026, 9:27 PMAntonio Sarosi (BAML π)
07/24/2026, 9:28 PMAntonio Sarosi (BAML π)
07/24/2026, 9:28 PMvEth
07/25/2026, 1:18 AMAntonio Sarosi (BAML π)
07/25/2026, 1:34 AMAntonio Sarosi (BAML π)
07/25/2026, 1:35 AMRemo
07/27/2026, 8:05 PMAntonio Sarosi (BAML π)
07/27/2026, 8:29 PMMaceo
08/04/2026, 1:58 PM