# Limits

Every run has a budget. When a script exceeds one, it stops with an error naming the limit. The setup pass (the script's top level, which defines its functions) and each call the platform makes into it get the whole budget.

Time is computing time: waiting for a `ctx` call does not count against it. Memory is what the script's own values take up. Operations count the steps the script performs.

| Where | Time | Memory | Operations |
|---|---|---|---|
| Playground and stored scripts | 5 s | 50 MB | 200 million |
| Workflow script nodes | 5 s | 50 MB | 200 million |
| Custom workflow actions | 5 s | 50 MB | 200 million |
| Incoming webhooks | the webhook's timeout, up to 30 s | 5 MB | 200 million |
| Custom app server functions | 5 s | 50 MB | 200 million |
| Workspace handlers | 5 s | 50 MB | 200 million |
| MCP tools | 5 s | 50 MB | 200 million |
| Archive jobs | 5 s | 50 MB | 200 million |
| Quote price tuning | 5 s | 50 MB | 200 million |
| Integration lifecycle hooks | the manifest's `timeout_ms`, up to 60 s | 50 MB | 200 million |
| Integration handler scripts | the manifest's `timeout_ms`, up to 60 s | 50 MB | 200 million |
| Integration server functions | the manifest's `timeout_ms`, up to 60 s | 50 MB | 200 million |
| Integration workflow actions | the manifest's `timeout_ms`, up to 60 s | 50 MB | 200 million |
| Integration upgrade scripts | the new manifest's `timeout_ms`, up to 60 s | 50 MB | 200 million |
| Data pipeline stages | 5 s | 50 MB | 200 million |
| Report preparation scripts | 5 s | 50 MB | 200 million |
| Scheduler penalty functions | 50 ms | 10 MB | 2 million |
| Product template resolvers | 5 s | 50 MB | 200 million |
| JDF and JMF templates | 5 s | 50 MB | 200 million |

Normal scripts can load up to 16 other scripts in a run with `ctx.script.load`.
Integration scripts can load up to 16 other scripts in a run with `ctx.script.load`.
Pure scripts cannot load other scripts.
Report preparation scripts also stop after 60 s in all, including waiting.
Every script can use at most 64 nested function calls, 100,000 entries in one table and 250 values returned or passed at once.
A single `ctx` call that takes longer than 30 s fails.

The server can be configured with lower ceilings for time and memory, which then apply to every script.

## Device HTTP responses

Device HTTP calls accept response bodies up to 1 MiB (1,048,576 UTF-8 bytes).
An oversized body or individual header returns `ok = false` with a size-limit
message before it enters Lua. The script can request a smaller page or handle
the failure; raising that returned message with `error` is catchable by `pcall`.
This does not make global execution-budget exhaustion recoverable.