# get_thread_agent

> **Function** in `deepagents_code`

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

Get agent_name for a thread.

## Signature

```python
get_thread_agent(
    thread_id: str,
) -> str | None
```

## Returns

`str | None`

Agent name associated with the thread, or None if not found.

---

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