Run lending quickstart
02 - Get started · Next: 03 - Understand
Identify application problem
A status update should invalidate a loan eligibility result and its recommendation while allowing an independent credit result to remain reusable. Refreshing every output repeats unaffected work; retaining every output leaves a stale recommendation.
This example uses deterministic synthetic byte values. It makes no model calls or financial decisions. After installing the base SDK, run from the repository root:
python examples/quickstart.py
You have now executed a complete workflow with selective replacement, immutable artifact identities and a controlled concurrent update.
Outcome
The program asserts these results and prints JSON containing them:
{
"executions": {"eligibility": 2, "credit": 1, "recommendation": 2},
"credit_reused": true,
"late_result_rejected": true
}
It also prints actions_after_update, including assess/eligibility: recompute, assess/credit: reuse and recommend/default: recompute. These counters measure executed synthetic calculations, not plan entries or live model invocations.
Capture changing information
The executable source creates a bounded authority and registers status=active-v1 and credit-history=good-v1. The host owns the matching bytes. Source versions are opaque labels, not values fetched by Co2.
Each attempt captures the registered inputs. It publishes only if the complete captured snapshot remains current at completion. This is why changing either captured input during the initial assessment would reject the whole result even if a particular output did not use that input.
Publish independent outputs
The assess computation publishes eligibility and credit as distinct output slots. Trusted developer declarations state that the synthetic eligibility code uses only status and the synthetic credit code uses only credit history. Both outputs are validated and published as one batch.
These declarations are accurate assertions about this small program. They are not dependency completeness inferred from model output, framework edges or intercepted reads. Invocation-level tracking remains the default for applications without such an assertion.
Replace affected work
flowchart LR
S[Status changed] --> E[Eligibility: recompute]
C[Credit: reuse] --> R[Recommendation: recompute]
E --> R
After registering inactive-v2, the host reads plan_actions(), keeps the current credit artifact, runs only eligibility, and derives a new recommendation from the replacement eligibility and retained credit artifacts. New work uses newly issued attempt and artifact identities. A final plan reports all current outputs reusable.
You have separated what changed from what the application chose to run. Co2 supplied the dispositions; the Python example performed the work.
Reject late result
The example begins another attempt on a worker thread, updates the registered status on the main thread, and then allows completion. Co2 raises StaleDependencyError; no artifact is published. The host abandons that attempt, and collection releases eligible retained state.
sequenceDiagram
participant Host
participant Co2
participant Worker
Host->>Co2: Capture status revision
Host->>Worker: Start synthetic calculation
Host->>Co2: Register newer status
Worker->>Co2: Publish result from old revision
Co2-->>Worker: Reject stale dependency
Host->>Co2: Abandon attempt
Keep Host contract
Supply every accessible input and accurate source versions, retain the data matching those versions, and register updates in authoritative order. Co2 cannot see unreported source changes. A plan does not lock external sources or authorize an action. Abandonment fences publication; it does not cancel external computation.
A stale result requires a new attempt with current context when execution is eligible. A capacity error requires collection/headroom or a deliberate configuration change, not blind retry. See operational failure handling.
Continue with core concepts or practical tutorials. Use python examples/lending.py to compare all three dependency strategies and execution classifications with conservative fallbacks.

