# generate_thread_id

> **Function** in `deepagents_code`

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

Generate a new thread ID as a full UUID7 string.

## Signature

```python
generate_thread_id() -> str
```

## Returns

`str`

UUID7 string (time-ordered for natural sort by creation time).

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/d1c6946218b4f0f86ab7b02b6bb6af1e4b75cede/libs/code/deepagents_code/sessions.py#L290)