# get_available_agent_names

> **Function** in `deepagents_code`

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

Return a sorted list of available agent names from `~/.deepagents/`.

Scans the user's `.deepagents` directory and returns each real
subdirectory that contains the `AGENTS.md` agent marker and is not an
app-reserved name. Fail-closed: bare directories, reserved app state
(`bin/`, `plugins/`, `conversation_history/`), symlinks, and hidden
entries are not agents.

Filesystem errors (missing parent, permission denied, broken entries) are
logged and surfaced as an empty list rather than raised — the caller shows
an empty modal instead of crashing mid-render.

## Signature

```python
get_available_agent_names() -> list[str]
```

## Returns

`list[str]`

Sorted list of agent names. Empty when no agents exist yet or the
directory is unreadable (see log for the underlying cause).

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/2069079e09546060f5b52b2cd4f0e3c813e820f3/libs/code/deepagents_code/agent.py#L1274)