Skip to main content
Use one retained setup operation when several tasks need the same dependencies or fixtures. Each task starts on new compute from the saved filesystem image; processes, memory, services, and connections from setup are gone.

Prerequisites

  • Complete Set up access.
  • In a fresh project, run uv init --python 3.12 and uv add "contree-sdk[async]==0.5.1" "contree-client==0.6.0".
  • The example uses the available tag:alpine:latest image. An immutable image UUID can be substituted.

Complete source

Save as reuse.py:
Run uv run python reuse.py. The output ends with A and B. The first line is the immutable checkpoint UUID to record with the setup revision.

State, failure, and retention

ContreeAsyncSession starts a separate VM for each command. The setup retains its filesystem and exposes its UUID through setup.image_uuid. Each reader opens an independent session on that checkpoint and uses disposable=True, leaving the selected image unchanged. run() returns a process result rather than an image wrapper. If a reader fails, inspect result.state, result.stdout, and result.stderr, including each stream’s truncated flag, then rerun only that task from checkpoint_uuid. An SDK wait timeout triggers a best-effort cancellation; resolve an uncertain operation outcome before resubmitting. A local UUID or session history entry does not extend remote retention. See Limits, retention, and usage before choosing a long-term storage strategy.

References