Study FAQ
When should I continue, resume, or fork a Claude Agent SDK session?
Also asked as 2
- How do I pick continue, resume, or fork for Claude Agent SDK conversation history?
- What state is preserved when I resume or fork a Claude Agent SDK session?
Answer
Continue when you want to append a follow-up to the existing conversational thread. Resume by session ID when a later request or process restart must pick up a particular thread. Fork when you want a new session ID with a copy of the prior conversation so you can explore an alternative while preserving the original history.
- Continue: the Python
ClaudeSDKClienttracks a live session. For a most-recent-session lookup, Python offerscontinue_conversation=Trueand TypeScript offerscontinue: true. Prefer an explicit session ID when several sessions could qualify. - Resume: keep the ID and the persisted transcript available to the serving host. The SDK normally persists its conversation to disk. If persistence is disabled, the host needs an available transcript to return to it later. A different machine needs access to the transcript through an appropriate storage arrangement.
- Fork: use the separate ID for the new conversational path. Two sessions working in the same directory still see real changes to shared files.
The stored conversation can preserve previous tool results as evidence of what was seen at the time. Recheck live state and authorization before relying on that evidence for a write. Manage durable operations, filesystem checkpoints, and database recovery through their own mechanisms.
Full explanation
Claude Agent Loops, Sessions, and Runtime Controls
Study guide · CCAR-F
Read the full explanation