> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate Config With Doctor • AI Agent SDK

> migrate_config_with_doctor: Apply the declarative migration rules once and stamp ``config_version``.

# migrate\_config\_with\_doctor

Function

> This function is defined in the [**config**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/config.md) module.

Apply the declarative migration rules once and stamp `config_version`.

Returns `(migrated, applied_reasons)`. The input is copied shallowly (and
per-channel dicts copied) so the caller's mapping is not mutated in place.
Only rules whose `detect` fires contribute a reason, so a config already
at the current shape migrates cleanly with an empty reason list while still
receiving the version stamp. This is the single migration executor behind
`gateway doctor --fix`.

Raises :class:`ConfigVersionError` when the config was written by a *newer*
build (its stamp exceeds :data:`GATEWAY_CONFIG_VERSION`) or the stamp is
malformed — an older binary must never downgrade a newer config or drop
keys it does not understand.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def migrate_config_with_doctor(raw: Dict[str, Any]) -> 'Tuple[Dict[str, Any], List[str]]'
```

## Parameters

**raw** `Dict[str, Any]` *required*

No description available.

### Returns

**Returns** `'Tuple[Dict[str, Any], List[str]]'`

The result of the operation.

## Uses

* `ConfigVersionError`
* `rule.detect`
* `rule.fix`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/config.py#L267)
>
> `praisonaiagents/gateway/config.py` at line 267

***

## Related Documentation

> [card] [Configuration Overview](https://praison.ai/docs/docs/configuration/index)

> [card] [Agent Config](https://praison.ai/docs/docs/configuration/agent-config)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.