# destroy()

Canonical URL: https://developers.iagenify.com/sdk/ref/local-agent/destroy/
Language: en

`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.

Status: three places · 404 is success · nothing without a session

```javascript
await agent.destroy();   // { ok: true }
```

## In that order, and for a reason {#order}

- 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 {#404}

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 {#no-session}

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 {#workspace}

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.

- [rewind()](/sdk/ref/local-agent/rewind): Undoing the work instead.
- [The device journal](/sdk/agent/sessions/journal): The second thing removed.

```python
agent.destroy()   # {"ok": True}
```
