# delete_offloaded_history

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/offload/delete_offloaded_history)

Remove a thread's compaction archive and handoff recovery snapshots.

Deletes the per-thread markdown file written by the local-mode
`conversation_history` backend (`{root}/conversation_history/{thread_id}.md`),
resolving `root` with `_offload_fallback_root` so the persistent
`~/.deepagents` location and any temporary fallback are both covered.
Handoff snapshots encode their source thread's ownership in their filenames
and are removed with that source, including snapshots from failed handoffs.
A child summary's recovery link lasts only as long as its source archive.

Best-effort: filesystem failures are logged and swallowed rather than
raised, so a failed cleanup never blocks thread deletion. Resolving the
offload root is not side-effect-free -- it creates (and hardens) the
`conversation_history` directory and writes a short-lived probe file -- so a
call for a thread that has no archive still touches the filesystem before
returning `False`.

In server/sandbox mode the archive lives on the sandbox backend rather than
the local `~/.deepagents` directory, so there is no local archive to remove.

## Signature

```python
delete_offloaded_history(
    thread_id: str,
) -> bool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `thread_id` | `str` | Yes | Thread whose offloaded history should be removed. |

## Returns

`bool`

`True` if at least one archive file was removed. `False` otherwise:

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4bfa52000ef65ac623d8ada0cb67f67cbdd663ea/libs/code/deepagents_code/offload.py#L414)