Runtime control

Stopping

Trip an abort signal from anywhere: another thread, a job, a Stop button. The partial turn persists and the session resumes cleanly later.

signal = Mistri::AbortSignal.new
agent.run("Draft a long essay.", signal: signal)
# elsewhere
signal.abort!

Budgets

Ceilings are opt-in and off by default. A run that hits one stops with result.aborted? and the reason:

budget = Mistri::Budget.new(turns: 20, cost_usd: 2.00)
agent = Mistri.agent("claude-opus-4-8", budget: budget)

tokens: and wall_clock: are there when you need them. Thinking is never constrained by default.

Retries

Transient failures (429s, 5xx, timeouts, dropped streams) retry with backoff, invisibly to the model. On by default; tune or disable per agent:

policy = Mistri::RetryPolicy.new(attempts: 5)
Mistri.agent("claude-opus-4-8", retries: policy)
Mistri.agent("claude-opus-4-8", retries: false)

A run that exhausts its retries returns result.errored? with the error recorded on the session, never a half-written turn.