# 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 found there. Symlinks excluded so a dangling link does not
masquerade as an agent. Dot-prefixed entries (e.g., `.state/`) are
skipped so internal app state never appears as an agent.

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/0412009c5441bef8d75a427e1da8909e33ab5b56/libs/code/deepagents_code/agent.py#L456)