await agent.destroy(); // { ok: true }agent.destroy() # {"ok": True}In that order, and for a reason
- The account's copy first.
- Then the device journal — the tool results, the only place they existed.
- Then the checkpoints in the workspace.
A refusal is raised. Swallowing it would answer { ok: true } while the session still existed: the caller removes it from the screen, the next read brings it back, and nothing says why.
A session that was never written is already gone
A 404 from the account is not an error here: there is nothing to remove, and the outcome is the one asked for. Anything else is raised.
Without a session it does nothing
An agent with memory: false has nothing stored anywhere. It answers { ok: true } and makes no request.
It does not touch the workspace's files
Only the checkpoint store — the files the agent created or changed stay exactly as they are. Destroying a session is forgetting the conversation, not undoing the work.