# restore_user_langsmith_env

> **Function** in `deepagents_code`

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

Restore launch and project-dotenv LangSmith settings for user commands.

Precedence, highest first: the launch shell the user started `dcode` from,
then the project `.env`. The global profile `.env` is deliberately excluded,
because it configures the agent rather than the user's own commands.

Also pops the client-to-server carrier and every `DEEPAGENTS_CODE_`-prefixed
selector, so `agent.py` can pass the result with `inherit_env=False`.

## Signature

```python
restore_user_langsmith_env(
    env: dict[str, str],
    *,
    start_path: Path | None = None,
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `env` | `dict[str, str]` | Yes | Environment for user commands, modified in place. |
| `start_path` | `Path \| None` | No | Project directory whose `.env` supplies the lower layer. Falls back to the mapping bootstrap captured for this process. (default: `None`) |

---

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