# Sessions and recovery

Understand admission, completion, request identities and continuing work.

Source: cd46e0e78d73497aec99e3e8d33c1fef632f36f9
URL: /sessions

An agent is an installed program. A session is one continuing use of that
program. Many independent sessions can use the same agent. A runtime retains
their work; a session identity alone grants no filesystem or resource authority.

## Request identity [#request-identity]

Persist one request ID per business operation before sending it. After a lost
acknowledgement, retry that ID with the same agent and input. A new ID starts new
work. Read retained outcomes instead of rerunning completed effects.

## Observe the result [#observe-the-result]

`berry run --wait` waits until the execution finishes or needs input. Use
`berry inspect EXECUTION_ID` for its actual outcome and `berry calls EXECUTION_ID`
for child calls. A wait timeout exits with code 124 and does not stop the work.

For continuing sessions, `berry message` sends input to a thread. Use
`berry interrupt` to interrupt work and `berry close` when ending that thread is
intended. The [CLI reference](/reference/cli) owns the exact command arguments.

## Updating an installation [#updating-an-installation]

Deploy to the same installation ID. The CLI reads its current revision and
preserves grants unless you explicitly replace them. Use `--expected-version`
when automation must require a previously observed revision. This value is an
opaque concurrency position, not a plugin release number.

Accepted finite work retains its code. Continuing sessions can adopt compatible
selected code at an idle boundary. Updating a selection does not rewrite History
or accepted calls. Inspect the actual continuation result before claiming recovery.

## Uncertain effects [#uncertain-effects]

A disconnected client does not establish that a tool failed. Preserve the
original identities and inspect retained evidence. Avoid issuing a new request
that could repeat an external effect. Reconciliation belongs to the operation
and its recovery contract.
