Lesson 1 of 4
Move a Session Without Losing It
Estimated time: 10 minutes
A handoff is a state translation, not a rename
Moving a session from one model to another is not a rename in a config file. The two models may read the same transcript differently, accept different token limits, and emit tool calls in different shapes. If the carried state is not rewritten for the new model, the session answers as if it had lost its recent turns.
Move at a turn boundary
The safe point to move is between turns, once the current call has returned. Moving in the middle of a half written tool call leaves the new model holding a fragment it did not finish.
Translate, then confirm, then release
Rewrite the system framing and any tool schema the new model needs, carry the transcript across so history is kept, and confirm the new model can continue before the old one is released. Only the confirmation reply makes the move real.
def handoff(state, target_model):
translated = translate(state, target_model)
if not can_continue(translated, target_model):
return state, 'held'
return translated, 'moved'
Keep the way back
Hold the old model warm until the first good reply arrives. A handoff with no way back turns a bad translation into a lost session.