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

python
def migrate_config_with_doctor(raw: Dict[str, Any]) -> 'Tuple[Dict[str, Any], List[str]]'

Parameters

ParamField Dict[str, Any]

No description available.

Returns

ResponseField 'Tuple[Dict[str, Any], List[str]]'

The result of the operation.

Uses

  • ConfigVersionError
  • rule.detect
  • rule.fix

Source

View on GitHub

praisonaiagents/gateway/config.py at line 267


Related Documentation