Skip to content
ttorta docs

Knowledge Base

Budgets and leases

A session has a wall clock, a token cap and a tool-call cap, and a dead session gives its ticket back.


Budgets

A session carries four limits, set under workflow.sessionBudgets in torta.json:

Key Default Meaning
wallClockMs 1800000 30 minutes of wall clock per ticket
tokens 200000 tokens spent on this ticket
toolCalls 200 tool calls made on this ticket
continuations 8 how many times a session may carry on

The wall clock runs from the ticket’s delivery, not the age of the pane.

When a limit trips, the session stops, the tool call that would have crossed it is denied, and a budget_breach event is written. The ticket is parked in BLOCKED with the limit that tripped and the cost so far.

These budgets belong to the SDK runner. A ticket delivered into a pane gives up the token budget, the tool-call budget and the approval intercept, and is logged as a pane_deliver event.

Leases

An agent home holds one session at a time, claimed by a lock file carrying the pid, the host, the agent, the ticket, its start time and its last heartbeat.

The engine refreshes the heartbeat of everything it is running. A lock whose heartbeat is older than staleLockMs, 120 seconds by default, belongs to a session that is gone.

Each tick the engine takes back what a dead session left behind, writing the reclaim into the ticket’s history in one of two forms:

  • no lock was found for the agent
  • the session holding it, by pid and host, is no longer running

A reclaim writes a lease_reclaim event, and the reclaimed wip ticket outranks everything queued on the next pass.

Working in a home by hand

Say so when you are working a ticket yourself:

torta watch --busy frontend

Nothing is started in that agent’s home while the flag is set.