> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackshift.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Budgets, stopping and runaway protection

> Three budgets, a Stop button that halts everything at once, and layers that stop an agent that loops or fails.

> [!NOTE]
>
> **Not yet released.** This guide describes implemented changes awaiting rollout. Availability requires the corresponding backend and dashboard release.

## Goal

Cap what an agent can spend, stop it instantly, and know what stops it on its own.

## Prerequisites

* An agent. Budgets come from `budget:` in `stackshift.yaml` and can be changed in the agent’s settings or with `stackshift agents budget set`.

## Workflow

**Step 1**

Set the AI budget for a month, the AI budget for one run, and the running-time budget for a day.

**Step 2**

Watch the Spend tab: AI credits and running time per day against each budget, in Naira or US dollars.

**Step 3**

When you need to halt the agent, press Stop on any of its pages, or run `stackshift agents stop <agent>`.

**Step 4**

To go again, press Start. After a budget stop or an abuse stop, only the owner can start it.

## The three budgets

Raising a budget is for the owner. Lowering one is a safe change. Your account’s AI credits and wallet still apply on top: the agent can never go negative.

* AI per month: you are told at 80%. At 100% model calls are refused and the agent stops itself.
* AI per run: at 100% that run’s model calls are refused and the run ends.
* Running time per day: at 100% the agent sleeps with waking turned off until tomorrow or until you raise it.

## What Stop does

You can stop any agent at any time. So can Stackie and connected agents, because stopping is a safe change with a one-step undo. Starting again after a budget or abuse stop is for the owner.

* Refuses every model call and every action from the agent.
* Turns off its inbox sending and its agreement limits.
* Puts it to sleep with waking turned off.
* Deletes nothing. Start undoes it.

## What stops an agent on its own

* Every call: `max_tokens` is required and capped.
* Every run: the run budget, a time limit of 30 minutes by default, and at most 200 model calls.
* A loop: the same request, the same prompt and tools, more than 5 times in 2 minutes in one run pauses the agent.
* Five failures in a row: five failed or refused actions, or failed runs, pause the agent.
* A spend spike, a flood of blocked internet requests, and many refused actions in a row raise alerts that can stop the agent.
* The month: at 100% of the monthly AI budget the agent stops.

## Expected result

> [!TIP]
>
> The agent can never spend more than its budgets or your account holds, and Stop halts its model calls, actions, email sending and agreements within seconds.

## Common failures

> [!WARNING]
>
> * The agent says it stopped for its monthly AI budget. Raise the budget, then start it. Raising a budget is for the owner, signed in.
> * The agent sleeps and does not wake until tomorrow: it used its running-time budget for the day.
> * The agent stopped after failures: five failed actions or runs in a row. Read the last runs for the cause before you start it.

## Related guides

> [card] [Model access for agents](https://docs.stackshift.cloud/ai-features/hosted-agents-models.md)
>
> Your agent calls Anthropic or OpenAI through StackShift with a short-lived token. No provider key is ever in the agent.

> [card] [Your agent’s own actions: risk, approvals and levels](https://docs.stackshift.cloud/ai-features/hosted-agents-actions.md)
>
> Declare the tools your agent has, give each a risk, and let StackShift apply the agent’s level, approvals and untrusted-text checks before they run.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.