# is_sole_session

> **Function** in `deepagents_code`

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

Return whether no other dcode session holds this installation.

Converting a `flock` is not atomic: the shared lock is released before the
exclusive one is tried, so two processes checking at once could each see
the other as absent. An exclusive lock on `sessions.check.lock` beside
`SESSION_LOCK_FILE` admits one checker at a time; a process that finds it
taken is not alone.

## Signature

```python
is_sole_session() -> bool
```

## Returns

`bool`

`True` only when this process holds the session lock and could take
it exclusively. `False` when another session holds it, or when the
lock is unavailable and presence cannot be known.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/6a8d452d70f9bcb978e6bd44831dda093ecbe928/libs/code/deepagents_code/_session_lock.py#L109)