Limits and cancellation
createSandbox({
frame: { url: '/sandbox' },
caps: {
timeoutMs: 60_000, // wall clock of the run; pauses while a human decides
busyMs: 10_000, // longest the code may run with no function call in flight
maxOps: 200, // function calls per run
maxOutputBytes: 1_000_000, // the run value and each call result
maxInputBytes: 1_000_000, // each call input
maxLogLines: 200, // console lines kept; the rest counted in stats.logsDropped
maxLogChars: 262_144,
},
});These are the defaults. Two clocks: timeoutMs bounds the whole run (time
inside your functions counts, since a hung endpoint must still end the
run; time waiting for a human does not); busyMs bounds how long the
worker may run with nothing outstanding, which is what ends while (true)
in seconds without starving a run that chains slow calls. Any limit
terminates the worker and resolves status: "limit"; the message is
worded for a model.
An AbortSignal in run resolves status: "aborted" and terminates the
worker, mid-loop if need be.