# is_media_path

> **Function** in `deepagents_code`

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

Return whether a path's extension is a known image or video extension.

This is a cheap, extension-only check (no file read or decode). Use it to
classify a dropped file path as media without loading it, e.g. to reject a
dragged image in a text-only input.

It is a heuristic, not a support check, and disagrees with the loaders in
both directions: `get_image_from_path` accepts anything Pillow can decode
regardless of extension, while `get_video_from_path` additionally requires a
recognized magic-byte signature. Call `get_media_from_path` when the answer
must match what can actually be attached.

## Signature

```python
is_media_path(
    path: pathlib.Path,
) -> bool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `pathlib.Path` | Yes | Path whose suffix is inspected. |

## Returns

`bool`

`True` when the suffix is a known image or video extension.

---

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