# Pause Trace

Stop model calls and Trace checks during an incident, beside Pause all, and release the agent sessions a Trace rule locked.

Two switches sit outside your [Trace rules](https://provenanceauth.com/docs/trace/guides/trace-rules.md), where no rule can reach them. Use them during an incident, when you'd rather stop first and look second.

**Before you begin:** export the sandbox account key, which has Trace.

```bash
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
```

| Switch | What it stops | What keeps running |
| --- | --- | --- |
| **Pause Trace** | Traced model calls, Trace checks, Trace assessments, signed readings, new trace jobs and eval runs | Agent payments, Mandate assessments and the other products |
| **[Pause all](https://provenanceauth.com/docs/mandate/guides/pause-all-agents.md)** | Every agent: intents, Mandate assessments, merchant and call checks, and Trace too | Reads, lists and exports |

The two are separate: lifting one never lifts the other. While both hold, responses name `agents_paused`, the wider one.

## Who can pause

An owner or admin, in a signed-in console session, confirming with a passkey or a code. No API key can pause or resume either switch, whatever its scopes (`403` [`trace_pause_needs_session`](https://provenanceauth.com/docs/platform/errors.md#trace_pause_needs_session)), and no rule can override them. The SDKs never cache a pause: the server decides on every call.

In the console, open **Trace › Pause**: **Pause Trace** and **Pause all** sit side by side, each with one line on what it stops. **Pause Trace** is also on the **Agents** page. While Trace is paused, a banner runs across the console with **Resume Trace**.

## What a paused account answers

| Request | Under the Trace pause |
| --- | --- |
| [`POST /v1/trace/assessments`](https://provenanceauth.com/docs/api/trace-assessments.md#post-v1-trace-assessments) | `outcome: "deny"`, reason `trace_paused`, recorded, not evaluated, not billed |
| [`POST /v1/trace/check`](https://provenanceauth.com/docs/api/trace-checks-and-locks.md#post-v1-trace-check) | `decision: "block"`, reason `trace_paused` |
| [`POST /v1/trace/chat/completions`](https://provenanceauth.com/docs/api/traced-inference.md#post-v1-trace-chat-completions) | No generation: `content: null`, `finish_reason: "trace_paused"` |
| Signed readings, re-runs, new trace jobs and eval runs | `403` [`trace_paused`](https://provenanceauth.com/docs/platform/errors.md#trace_paused); jobs already running finish |
| Intents and Mandate assessments | Keep running. An agent rule that names a Trace fact sees it unavailable (`trace_paused`), and its fail setting decides |

Read the state any time:

**curl**

```bash
curl -s $PROVENANCE_API/v1/trace/settings/pause -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const res = await fetch(`${process.env.PROVENANCE_API}/v1/trace/settings/pause`, {
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
});
console.log((await res.json()).paused); // false
```

**Python**

```python
import os, httpx

r = httpx.get(f"{os.environ['PROVENANCE_API']}/v1/trace/settings/pause", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"})
print(r.json()["paused"])  # False
```

```json
{ "object": "trace_pause", "paused": false, "paused_at": null, "paused_by": null, "reason": null }
```

Resuming Trace while Pause all holds succeeds with `still_paused_by: "pause_all"`, so the person knows Trace is still stopped. `trace.pause.started` and `trace.pause.ended` tell your webhook, and each change is a security event (`trace_paused`, `trace_resumed`).

## Session locks

A Trace rule with `lock` locks the agent session (or the registered agent) until a person releases it; Mandate assessments for that session answer `session_canary_locked` meanwhile. The locks are listed on **Trace › Pause**, and through the API:

**curl**

```bash
curl -s "$PROVENANCE_API/v1/trace/session_locks?status=active" -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const locks = await prov.trace.sessionLocks.list({ status: "active" });
```

**Python**

```python
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
locks = prov.trace.session_locks.list(status="active")
```

Each lock names where it came from:

- `source` (string): `rule` (an action assessment), or `inference`, `preflight` or `check` on model output.
- `rule_id` (string): The Trace rule whose `lock` wrote it.
- `assessment_id` (string): The assessment it belongs to.
- `actions` (object): Whether the rule also suspended the agent or revoked the session's tokens.

Release one with [`POST /v1/trace/session_locks/{id}/clear`](https://provenanceauth.com/docs/api/trace-checks-and-locks.md#post-v1-trace-session-locks-id-clear) (an owner or admin session, or an admin-scope key); releasing it lifts a suspension the lock applied, and only that one.

## The kill switch

The kill switch and its settings were removed: each account's setting became a Trace policy, and what a trip does is now a rule on model output. See [Trace rules on model output](https://provenanceauth.com/docs/trace/guides/trace-rules.md#on-model-output). Requests that still send `provenance.on_trip` get `400` [`parameter_removed`](https://provenanceauth.com/docs/platform/errors.md#parameter_removed).

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| `403` [`trace_pause_needs_session`](https://provenanceauth.com/docs/platform/errors.md#trace_pause_needs_session) | An API key tried to pause or resume | Pause or resume from a signed-in console session. |
| `403` [`trace_paused`](https://provenanceauth.com/docs/platform/errors.md#trace_paused) on a reading or job | Trace is paused | Resume Trace once the incident is over. |
| Mandate assessments answer `session_canary_locked` | A Trace rule locked the session | Review the trace, then release the lock. |
| `400` [`parameter_removed`](https://provenanceauth.com/docs/platform/errors.md#parameter_removed) | A request still sends a kill-switch field | Remove it and write the behavior as Trace rules. |

## See also

- [Trace rules](https://provenanceauth.com/docs/trace/guides/trace-rules.md): what a trip does, on actions and on model output.
- [Pause all agents](https://provenanceauth.com/docs/mandate/guides/pause-all-agents.md): the account-wide stop.
- [Webhook events](https://provenanceauth.com/docs/reference/webhook-events.md): `trace.pause.started` and `trace.pause.ended`.
