# Runtime guarantees

The Governor drives a verified actor, records external events, and starts work through
fulfillers. The application supplies the effect, authentication, and provider boundaries.

## Recovery

Recovery reconstructs the actor from a snapshot and the recorded events. Recorded events
are applied without calling models or tools. Resuming can start a request that was still
pending at the last append. If the effect happened before its result was recorded, the
request can run again with the same idempotency key. Store that key atomically with the
effect or use a provider that enforces it. For multiple workers on a shared journal, give
every driver a lease so stale owners cannot append. [Crash and resume](../tutorials/durability.md)
and [Running as a service](../guides/running-as-a-service.md) show both boundaries.

```mermaid
sequenceDiagram
    participant G as Governor
    participant E as Effect store
    participant J as Journal
    G->>E: Apply effect using the call key
    E->>E: Commit effect and key together
    Note over G,J: Process stops before the result is appended
    G->>J: Recover pending request in a new process
    G->>E: Retry with the same key
    E-->>G: Return the stored result
    G->>J: Append the result
```

The effect store already has the key at the point of recovery. A second request can
return the saved result without applying the effect again.

## Approval

Use `Governor.answer` with the pending request for an external answer. The application
authenticates the caller and passes a `Principal` as `by`. Configure entitlement to decide
which authenticated callers may answer. When a deadline is already due, the Governor
can record the wake and ensuing work before refusing the late answer. See
[Humans and interruption](../concepts/human-in-the-loop.md) and [Time](../concepts/time.md).

## Spending

An allowance counts model usage recorded in the journal. It gives an interruptible actor
one `interrupted` event per drive when the run reaches the threshold and wants more work.
The reference agent suspends. A custom actor can request work in response. Provider
bills can also include work hidden inside an SDK retry or a fallback model call, or work
whose answer was never recorded. Use the provider or deployment's own
spending controls when you need a billing ceiling. [Spending and rate limits](../guides/spending-and-rate-limits.md)
shows the recorded tally and how to resume with a different allowance.
