Events

checkpoint

{ type: "checkpoint", n, files, durationMs }

The workspace was photographed before your message. One per message, and the number is what rewind() takes.

once per messageneeds a sessionnever blocks
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Fields

ninteger

This message's number in the session. rewind(n) goes back to just before it.

filesinteger

How many files the point records.

durationMsinteger

How long the snapshot took.

When it is emitted

Before your message is added to the conversation, so it records the workspace as it was — the state a rewind returns to. It is the first event of a run.

No event means no point

Why there is noneConsequence
The agent has no session (memory is off)rewind() answers session_required
checkpoints: falserewind() answers checkpoints_disabled
It is a subagentA subagent keeps none
The snapshot could not be taken at allThe run continues, and that message cannot be returned to
A failed snapshot never stops an answer

Going back is a comfort, not a requirement — so a store that cannot be written is skipped in silence rather than failing the run. Listening for this event is how an interface knows whether « go back to here » can be offered.

What durationMs tells you

A snapshot is content-addressed, so an unchanged workspace is nearly free — only the list is new. A duration that grows steadily means a lot of changed content per message; one that is large from the start means a large workspace.

Offering it

const points = [];

onEvent: (e) => {
  if (e.type === "checkpoint") points.push({ n: e.n, files: e.files });
};

// Later: await agent.checkpoints() for the full list, with what each one cannot undo
points = []

def on_event(event):
    if event["type"] == "checkpoint":
        points.append({"n": event["n"], "files": event["files"]})

# Later: agent.checkpoints() for the full list