> ## 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

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**config**](../modules/config) 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

<ParamField query="raw" type="Dict[str, Any]" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="'Tuple[Dict[str, Any], List[str]]'">
  The result of the operation.
</ResponseField>

## Uses

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

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/config.py#L147">
  `praisonaiagents/gateway/config.py` at line 147
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Configuration Overview" icon="gear" href="/docs/docs/configuration/index" />

  <Card title="Agent Config" icon="robot" href="/docs/docs/configuration/agent-config" />
</CardGroup>
