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

# Long-running agents

> Tasks that pause, wait, plan, and check their own work.

Most runs finish in one pass. Real work often cannot: it needs to stop before an
irreversible step and ask, wait for something that has not happened yet, hold a
plan across dozens of turns, or confirm a result before calling it done. Cruq
agents do all of that through built-in tools you attach like any other, plus a
runtime that keeps a long run from falling over on its own length.

## Budgets

Every run is bounded by steps, wall-clock time, and tokens, and optionally by
spend. When a run reaches a limit it stops with a reason and keeps whatever it
produced so far, rather than failing empty. The token cap is on by default; a
spend cap only fires on providers that report cost, so it is opt-in per
workspace. These are guardrails against a runaway loop, not a normal stopping
point.

## Automatic compaction

As a conversation grows past the model's window, the runtime summarizes the
middle of the history and keeps the original task and the most recent turns
verbatim. You do nothing to enable it. If a token estimate is wrong and a
provider still rejects the history as too long, the run compacts harder and
retries once rather than dying. The effect is that a genuinely long task keeps
going instead of hitting a wall.

## Pause for a person

Attach **Ask a Human**. The agent stops before anything it should not decide
alone (sending a message on your behalf, spending money, deleting data, a
judgment call the instructions do not cover) and asks a specific question. The
run parks as **Paused** and can wait for days at no cost.

Answer it two ways:

* **Playground** reply in the chat, and the run continues while you watch.
* **AI Monitoring** answer box on the paused run, which resumes it in the
  background so you do not have to wait.

See [Observability](/docs/concepts/observability) for where paused runs appear.

## Wait on the clock

Attach **Wait Until**. Instead of asking a person, the agent parks itself until a
time it names and then resumes on its own, with nobody involved. Give it a
duration like `2h` or `3 days`, or an exact time like `2026-08-20T09:00:00Z`.
This is for "there is nothing useful to do until the report lands on Thursday":
the run sleeps at no cost and wakes itself when the time comes.

## Plans

Attach **Write Plan**. The agent records the task's goal and its steps, and the
plan is shown back to it at the start of every turn, so it survives even a very
long run and does not drift into working on the wrong thing. Each step can carry
an **acceptance** line (what proves that step is done) and a **verification
recipe** (how to check it).

## Check its own work

Attach **Verify Plan**. Before the agent claims a task is finished, it can ask a
fresh, independent agent, one that never saw the work, to confirm each completed
step actually meets its acceptance criterion. A step that does not hold up is
sent back to be finished. The point is that the agent that did the work is the
worst judge of whether it is done; a blank pair of eyes is not.

## Adding these tools

In the agent builder, open **Tools & Connections**, then **Add built-in tool**,
and pick the ones you want. Over the API, create the tool with
`POST /v1/tools` and attach it to an agent version; see the
[API reference](/docs/api-reference/overview).
