LocalAgent

destroy()

agent.destroy() → Promise<{ ok: true }>

Removes the session: the account's copy, the device journal and its checkpoints. A refusal is raised rather than swallowed.

three places404 is successnothing without a session
Using Python?

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

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.
If the account refuses, nothing local is deleted either

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.