# find_project_agent_md

> **Function** in `deepagents_code`

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

Find project-specific AGENTS.md file(s).

Checks two locations and returns ALL that exist:
1. project_root/.deepagents/AGENTS.md
2. project_root/AGENTS.md

Both files will be loaded and combined if both exist.

Candidates with symlinked path components are followed only when the
resolved target stays inside `project_root`. The returned `Path` is the
resolved target when any symlink component was traversed, so
`FilesystemBackend.download_files` opens a regular file rather than
tripping `O_NOFOLLOW` on the link itself. Symlinks pointing outside the
project root, symlink loops, and unreadable parents are skipped with a
warning. Broken symlinks are treated as missing files (no warning),
matching the pre-existing behavior for absent candidates.

Why: project AGENTS.md is auto-discovered and loaded into the system
prompt before the first model call. Without the in-tree check, a
malicious clone could ship `AGENTS.md -> ~/.ssh/config` (or any other
locally-readable file) and have its contents injected as agent
instructions on first run.

## Signature

```python
find_project_agent_md(
    project_root: Path,
) -> list[Path]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_root` | `Path` | Yes | Path to the project root directory. |

## Returns

`list[Path]`

Existing AGENTS.md paths, with in-tree symlinked path components
pre-resolved to their targets. Empty if neither file exists, one
entry if only one is present, or two entries if both locations
have the file.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/0412009c5441bef8d75a427e1da8909e33ab5b56/libs/code/deepagents_code/project_utils.py#L150)