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
</div>
This function is defined in the 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
def migrate_config_with_doctor(raw: Dict[str, Any]) -> 'Tuple[Dict[str, Any], List[str]]'Parameters
Dict[str, Any]No description available.
Returns
'Tuple[Dict[str, Any], List[str]]'The result of the operation.
Uses
ConfigVersionErrorrule.detectrule.fix
Source
View on GitHubpraisonaiagents/gateway/config.py at line 267