# 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/3812967c84d90619848f3185f22470204fc88bd8/libs/code/deepagents_code/sessions.py#L1410)