# ensure_agent_dir

> **Function** in `deepagents_code`

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

Create the validated profile directory for an agent.

## Signature

```python
ensure_agent_dir(
    agent_name: str,
) -> Path
```

## Returns

`Path`

Path to the agent's profile directory.

---

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