Branch and append to a session
You run multi-turn or speculative agent flows and need causal, conflict-safe history.
01
Open a session and branch
Sessions are causal containers; branches are append-only event lines you can fork.
curl https://api.zumik.ai/v2/sessions/ses_…/branches \
-H "Authorization: Bearer zk_live_..." \
-d '{"fork_from_branch_id":"br_main","label":"debug-path"}'02
Append with expected_version
Every append carries the version it expects. A changed head returns 409 branch_version_conflict instead of corrupting history.
z.sessions.branches.append(
"ses_…", "br_…",
expected_version=17,
event={"type":"tool_result","content":"build green"},
)Where to go from here.
Got it running? Measure it.
Once requests flow through Zumik, a diagnostic shows exactly what you are reusing.