# get_provider_profile

> **Function** in `deepagents`

📖 [View in docs](https://reference.langchain.com/python/deepagents/profiles/provider/provider_profiles/get_provider_profile)

Look up the `ProviderProfile` for a model spec.

!!! beta

    `deepagents.profiles` exposes beta APIs that may receive minor changes in
    future releases. Refer to the [versioning documentation](https://docs.langchain.com/oss/python/versioning)
    for more details.

Resolution order:

1. Exact match on `spec`.
2. Provider prefix (everything before the first `:`), when `spec`
    contains a colon and both halves are non-empty.
3. `None` when neither matches.

When both an exact-model profile and a provider-level profile exist, they
are merged via `_merge_provider_profiles` with the exact-model entry
overriding the provider-level entry on conflicts.

When only the provider-level profile matches, a debug breadcrumb is
emitted so registrations layered on an exact key can be traced when they
don't apply (e.g. typo'd specs falling through to the provider default).

Malformed specs (empty string, more than one `:`, or a `:` with an empty
provider/model half) return `None` without consulting the registry. This
prevents a spec like `"openai:"` from silently matching the provider-wide
`"openai"` registration.

!!! note "Prefer `apply_provider_profile` for model construction"

    This function is intended for *inspection* (tooling, conditional logic
    on `pre_init` presence). To actually build a model, reach for
    `apply_provider_profile` — it composes lookup, `pre_init` invocation,
    and kwargs merging into a single call.

## Signature

```python
get_provider_profile(
    spec: str,
) -> ProviderProfile | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `spec` | `str` | Yes | Model spec in `provider:model` format, or a bare provider/model identifier. |

## Returns

`ProviderProfile | None`

The matching `ProviderProfile`, or `None` when no registered profile matches.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/46b6f3f3e6ce880cd5ec9cf59622bb745d6ac2eb/libs/deepagents/deepagents/profiles/provider/provider_profiles.py#L249)