Fluiddocs
Money

Spend caps and budgets

Limit what a connection, a job or an agent token can spend, and what Fluid does when a limit is reached.

Warnings and limits

  • Caps and budgets are off unless you set them. Set one only when you want a limit.
  • A connection's cap is a hard limit: a machine whose worst-case cost would pass it is refused, and a running job is suspended when the cap would be reached.
  • A job's budget acts a little early: when its cost plus 2 minutes of its machine's price would pass the budget.
  • A job whose budget or cap is spent cannot be resumed or moved until you raise it.
  • Costs are Fluid's estimates. A provider's bill can differ, for example by disks and data transfer that quotes leave out.
  • A budget must cover the machine's first lease (90 minutes) at the price the provider reserves, on EC2 spot the dearest zone's among those tried, or the launch is refused with the amount it could add.
  • A cap counts each machine's lease ahead (1 hour; 90 minutes for a new machine). A Modal sandbox and a Fargate task count their lease; a Container Apps replica counts its whole 24-hour limit. A move from Modal or Container Apps counts the source for the move's window only.
  • Caps and budgets limit what you spend at your own providers. A workspace's plan is a separate limit, on the compute it uses through Fluid each month. See Plans and billing.

Connection caps

A cap is a dollar amount for one connection. Set it when you connect, or change it later:

fluid connect aws --from-cli --cap 200

The console's Connections page, and the MCP tool set_cap, change a cap without touching the credentials. A cap is any amount from $0; $0 is a real limit. AWS EC2 and Fargate share their connection's cap.

Before a machine starts, Fluid adds its worst case (its price over its first lease, 90 minutes, or the provider's minimum billing) to what the connection has committed: what it has spent, plus what its running machines can still cost. If that would pass the cap, the machine is refused with a message such as:

aws: spent $182.40, committed $192.40, this resource could add $12.60, cap $200.00

The cap reads as you set it. The other amounts are to the cent, with more decimals only where cents would hide that they add up to more than the cap.

While a job runs, its machine's hard stop is kept about an hour ahead and renewed every 10 minutes, but only as far as the cap pays for. When the cap would be reached, the job is suspended; raise the cap to resume it. If the suspension fails, the job is stopped.

Job budgets

fluid run train.py --on SPEC --project training --budget 25

A budget is a limit for one job, in US dollars. When the job's cost plus 2 minutes of its machine's price would pass it, Fluid suspends the job and releases its machine. A budget suspension that fails stops the job. A job whose budget is spent is refused a resume or a move.

The budget policy can stop the job instead of suspending it (budget.action), and act earlier (budget.margin_min). An Owner can also set a default budget for jobs that set none. See Settings.

On a provider whose machines stop at a fixed limit (Azure Container Apps), the machine's limit is set to what the budget pays for, and that whole span is reserved from the budget up front while the job runs there: a move away is admitted only within the move's window. The plan's warnings and the job's first event say so with the numbers ("on aca the job's budget reserves $2.00 of $2.00 up front, for the machine's limit of 4.0 h at $0.500/h"). Modal holds the machine's lease instead, so nothing is reserved beyond it.

Agent token budgets

An agent token can carry a budget. It applies to each job the token starts, not to all of them together: a job started with the token cannot set a larger budget or turn the budget policy off. See Sign in.

Nothing left running

  • Every machine has a hard stop that Fluid keeps renewing. If Fluid stops renewing it, the machine ends itself.
  • Fluid checks every 15 s for machines past their lease or whose job has ended, and ends them 2 minutes later.
  • fluid audit lists everything Fluid runs on every connection, what leaked, and what a machine's end left in your cloud account that Fluid does not delete. An Owner cleans up leaks from the console's Machines page. What was left behind is yours to remove, with the command the audit shows.

On this page