# delete_cost

> **Function** in `deepagents_code`

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

Erase spend in the caller's thread-deletion transaction.

Retain only an ID tombstone to discard pending retries and late provider
completions, including answers that have not written their first charge.

## Signature

```python
delete_cost(
    conn: aiosqlite.Connection,
    thread_id: str,
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `conn` | `aiosqlite.Connection` | Yes | Sessions connection whose transaction owns thread deletion. |
| `thread_id` | `str` | Yes | Thread whose charges must be erased. |

---

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