# extra_for_package

> **Function** in `deepagents_code`

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

Return the installable extra that declares a package.

Resolves recovery hints from the package that is actually missing
instead of guessing from a provider identifier. For example,
`langchain-google-vertexai` maps to the `vertex` extra even though the
provider id is `google_vertexai`.

## Signature

```python
extra_for_package(
    package: str,
    distribution_name: str = 'deepagents-code',
) -> str | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `package` | `str` | Yes | Distribution package name to find in optional dependencies. |
| `distribution_name` | `str` | No | Name of the installed distribution to inspect. (default: `'deepagents-code'`) |

## Returns

`str | None`

The known extra name that declares `package`, or `None` when the
package is not declared by an individually-installable extra,
or when the distribution's metadata could not be read (logged
at `warning` level — callers should treat both cases the same
since the right fallback in either is `install_package_command`).

---

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