# restore_user_tracing_api_keys

> **Function** in `deepagents_code`

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

Restore caller tracing API keys in an environment passed to user code.

Reverts both bootstrap overwrites of the canonical LangSmith key — the
`DEEPAGENTS_CODE_`-prefixed override and the `/auth`-stored key — so shell
subprocesses receive the caller's own key rather than the agent's session
key. See `original_tracing_api_keys` for the rationale; this mirrors
`restore_user_tracing_env`, which does the same for tracing flags.

## Signature

```python
restore_user_tracing_api_keys(
    env: dict[str, str],
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `env` | `dict[str, str]` | Yes | Environment mapping prepared for a child/user subprocess. |

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e14e0adcbe78565ed3650e7f24b2a775d5437d25/libs/code/deepagents_code/config.py#L645)