# with_user_agent

> **Function** in `langchain_azure_ai`

📖 [View in docs](https://reference.langchain.com/python/langchain-azure-ai/_user_agent/with_user_agent)

Return ``headers`` with our UA prepended to any existing ``User-Agent``.

When ``headers`` is ``None`` and telemetry is enabled, a new dict is
returned containing only the ``User-Agent`` entry. When telemetry is
disabled the input is returned unchanged (or an empty dict for
``None`` input).

## Signature

```python
with_user_agent(
    headers: 'dict[str, Any] | None' = None,
) -> 'dict[str, Any]'
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `headers` | `'dict[str, Any] \| None'` | No | Existing header dict. Not mutated; a shallow copy is returned. (default: `None`) |

## Returns

`'dict[str, Any]'`

A new headers dict with the UA stamped in.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-azure/blob/7a6a664d617264df8dcb12fcfb1bacc09f21d504/libs/azure-ai/langchain_azure_ai/_user_agent.py#L170)