Skip to main content
A line an agent writes can loop forever, start processes without end, or grow a variable until memory runs out. In Mirage it runs beside other agents’ sessions, in one process or one isolate, so each of these would cost them too. Every limit below is on by default except max_workspaces and capacity, and each stops its case the way bash and Linux would, with the same exit status. Three layers set them:
  • The host (the server, or a Cloudflare app) sets ceilings. A workspace may set a lower value, never a higher one. A workspace that sets null (no limit) gets the ceiling.
  • The workspace sets each limit for every session it holds.
  • A profile overrides processes and command_limits for its sessions, field by field over the workspace’s. It may raise a workspace’s value as well as lower it; only a host ceiling holds it.

What each limit stops

What each limit counts:
  • max_env: bytes in a session’s variables, functions, aliases and positional parameters, plus 1 per array element and parameter.
    • A session that would start over it, from env, a profile or a snapshot, is refused.
  • processes.max: pipeline stages, subshells and background jobs running in the session.
  • max_body_bytes: decoded bytes of one API reply read whole.
    • A call’s own cap, or the memory left under max_memory, can stop it sooner.
    • An error reply keeps only its first 64 KiB.
For how the timeout command stops jobs, see Shell. Some bounds are fixed:
  • A session id, profile name or workspace id is 1 to 128 characters, with no control characters.
  • A command log read returns the newest 10,000 entries, and /.bash_history the newest 10,000 commands. A workspace that keeps its command logs in memory holds at most 8 MB of logs, and drops the oldest entries first.

Set them on a workspace

Here a batch session runs 512 processes and 15-minute lines, and every other session 64 processes and 2-minute lines. See configuration, profiles and output limits.

Set the host’s ceilings

A tenant controls its own workspace’s config and profiles, so a host that runs other people’s agents holds them under ceilings. Each comes from the app’s option, else its environment variable, else its key in ~/.mirage/config.toml:
The ceilings hold whatever sets the value: a create request, a profile replaced over HTTP, or a snapshot loaded later. The Python and TypeScript servers and the Cloudflare app take the same settings as options.