# project_root_for

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/hooks/trust/project_root_for)

Resolve the workspace root that governs hook trust for a directory.

## Signature

```python
project_root_for(
    cwd: Path | str,
) -> Path
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `cwd` | `Path \| str` | Yes | Session working directory. |

## Returns

`Path`

The enclosing project root, or the directory itself when it is not

---

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