Fork a session
POST/api/v1/sessions/:session_id/fork
Branches a new session from a point in this session's history: same context, different continuation.
The fork gets its own conversation whose messages reference the same documents as the parent rather than copying them, so there is one stored copy of the content and a retention purge erases it from both. Recorded tool results ride along on those messages and are replayed as model input on the fork's next turn — forking never re-invokes a tool, so exploring a "what if" cannot send an email or charge a card a second time. The consequence to accept is that a forked turn sees the tool data as it was, not as it is now.
The fork is created inert: auto_generate is false and no generation is triggered. Drive it with the normal message and generate endpoints. The fork has no actor — attach one only if the branch is meant to be driven by the same end user, since single_session_per_actor agents allow one open session per actor.
Request
Responses
- 201
- 400
- 401
- 403
- 404
Fork created
fork_at_position names no message in the parent conversation, or agent_id is unknown or belongs to another project
Unauthorized
Forbidden
Not found