# update_user_config

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/configuration/writer/update_user_config)

Serialize a read-modify-write of the user config and replace it atomically.

Writes the user tier only. The managed path is refused rather than trusted
to be unreachable.

A committed write to the default path also refreshes the shared process
resolver, so later reads see the new value. That refresh is best-effort and
never turns a landed write into a reported failure; see
`refresh_shared_resolver`.

## Signature

```python
update_user_config(
    mutate: Callable[[dict[str, Any]], bool],
    *,
    config_path: Path | None = None,
) -> WriteResult
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `mutate` | `Callable[[dict[str, Any]], bool]` | Yes | Edit applied to the table parsed inside the write lock. It must edit that table in place and return whether anything changed; overwriting it wholesale discards concurrent edits to sibling tables, which is the hazard the shared lock exists to prevent. |
| `config_path` | `Path \| None` | No | Override the default config location; intended for tests. The managed-config path is rejected. (default: `None`) |

## Returns

`WriteResult`

Transaction success, changed state, and safe error detail.

---

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