Skip to content

Latest commit

 

History

History
77 lines (50 loc) · 2.16 KB

File metadata and controls

77 lines (50 loc) · 2.16 KB

Checkpoint continuation

Restoring a saved checkpoint changes whether a fresh host process can resume and apply a pending itinerary change. This example shows checkpoint continuation in a generic Python travel-booking flow.

Domain

The domain is a small travel-booking change flow.

The user requests a change from the current itinerary to a new itinerary. That change requires confirmation before the host applies it.

Runtime

This is a generic Python example.

It does not call an LLM.

It does not use directive drafter.

What Context Compiler owns

Context Compiler owns:

  • authoritative policy state
  • the pending confirmation continuation state
  • the checkpoint that captures both

In this example, the pending checkpoint state is what makes the resumed confirmation meaningful.

Restoring authoritative state alone is not enough to resume the pending change.

What the host owns

The host owns:

  • the booking record
  • checkpoint persistence
  • request/process boundaries
  • the runtime behavior that actually applies the itinerary change

The host reads authoritative Context Compiler state after confirmation and decides whether to apply the booking change.

Why this is not prompt reinjection

This example does not re-send hidden instructions to a model.

The observable behavior change is host-side: the booking record changes only after a restored engine resumes the pending confirmation and authoritative state changes.

Example behavior

  1. The host starts with a booking on boston_trip.
  2. The user initiates a switch to chicago_trip.
  3. Context Compiler enters a pending confirmation state.
  4. The host exports and persists the checkpoint.
  5. A fresh host process restores that checkpoint into a new engine.
  6. If the user confirms, the host applies the itinerary change.
  7. If the user rejects or sends unrelated text, the booking remains unchanged.

Run

From the repository root:

uv run python python/examples/checkpoint_continuation/example.py
uv run pytest python/tests/test_checkpoint_continuation_example.py

FastAPI variant

For a request-boundary example, see python/examples/checkpoint_continuation/fastapi/README.md.