Context
PraisonAI PR #2075 (link) shipped a new doctor runtime configuration migration framework plus several new health-check subcommands. None of this is currently reflected in the docs.
Tracks upstream issue: MervinPraison/PraisonAI#1941
Merged commit: 2b3957a49f31dd362cdb2d0aafdafd9799a6d62d
Summary of what shipped (from SDK source)
1. New runtime SDK exports
File: src/praisonai-agents/praisonaiagents/runtime/__init__.py
New public symbols re-exported from praisonaiagents.runtime:
| Symbol |
Type |
Purpose |
DoctorContractProtocol |
Protocol (runtime_checkable) |
Contract third-party plugins implement to provide custom config migration rules |
Finding |
dataclass |
Result of a rule's collect_findings() call |
get_default_registry() |
function |
Returns singleton DoctorRulesRegistry |
register_rule(rule) |
function |
Register a rule on the default registry |
get_rules() |
function |
List registered rules (auto-loads built-ins + plugins) |
collect_findings(config) |
function |
Aggregate findings from every registered rule |
apply_fixes(config) |
function |
Apply fixes from every registered rule |
Source files added:
praisonaiagents/runtime/doctor_protocol.py — Finding, DoctorContractProtocol
praisonaiagents/runtime/doctor_registry.py — DoctorRulesRegistry, plugin discovery via entry point praisonai.doctor_contracts
praisonaiagents/runtime/builtin_rules.py — CliBackendMigrationRule (built-in)
2. Finding dataclass
@dataclass
class Finding:
rule_id: str
severity: str # "warning" | "error" | "info"
message: str
fix_description: Optional[str] = None
context: Optional[Dict[str, Any]] = None
3. DoctorContractProtocol (the plugin contract)
@runtime_checkable
class DoctorContractProtocol(Protocol):
@property
def rule_id(self) -> str: ...
def collect_findings(self, config: Dict[str, Any]) -> List[Finding]: ...
def apply_fix(self, config: Dict[str, Any]) -> Dict[str, Any]: ...
Plugins are discovered via the entry-point group praisonai.doctor_contracts (importlib.metadata, with pkg_resources fallback).
4. Built-in rule: CliBackendMigrationRule
rule_id = "cli_backend_migration"
- Detects
cli_backend: ... at the top level and inside roles.<role_name> of an agents.yaml.
- Migrates it to
models.default.runtime: <value> (preserving the same value, with a small mapping table for known IDs: claude-code, openai-gpt, anthropic, gemini).
5. New CLI: praisonai doctor runtime
File: src/praisonai/praisonai/cli/commands/doctor.py
praisonai doctor runtime [OPTIONS]
| Flag |
Default |
Purpose |
--team TEXT |
— |
Team YAML file to validate |
--workflow TEXT |
— |
Workflow YAML file to validate (future) |
--fix / (none) |
False |
Apply migration fixes |
--dry-run / --execute |
--dry-run |
Show changes vs apply changes (with timestamped backup) |
--json |
False |
JSON output |
--deep |
False |
Enable deeper probes |
--file, -f TEXT |
search agents.yaml/agents.yml/config.yaml/config.yml in cwd |
Config file to check |
Behavior (from runtime_migration_checks.py):
- Without
--fix: reports WARN with how many legacy configs found + suggests praisonai doctor runtime --fix.
- With
--fix and --dry-run: reports preview of changes; suggests --fix --execute.
- With
--fix --execute: writes migrated YAML, leaves a <stem>.backup.<YYYYMMDD_HHMMSS>.yaml next to the original.
- If
--file is supplied but the file does not exist: ERROR, severity HIGH.
- If no config file is found:
SKIP.
6. Additional new doctor subcommands shipped in the same PR
These are typer wrappers that forward to the existing doctor handler:
| Command |
Help text |
praisonai doctor docker |
Check Docker installation and configuration |
praisonai doctor llm-providers |
Check LLM providers configuration |
praisonai doctor memory-store |
Check memory store backends |
praisonai doctor metadata-store |
Check metadata store configuration |
All accept --deep and --json (except metadata-store, which is --json only).
7. Improved error messaging
doctor now distinguishes "module missing" from "module failed" in its error output (per the PR's "Bug Fixes" entry).
Documentation gap analysis
Searched docs repo. Current state:
| Doc |
Status |
Mentions new behaviour? |
docs/cli/doctor.mdx |
exists |
❌ No runtime, docker, llm-providers, memory-store, metadata-store subcommands |
docs/cli/doctor-cli.mdx |
exists |
❌ Same as above |
docs/features/cli-backend-protocol.mdx |
exists |
❌ No mention that cli_backend is now migratable via doctor |
docs/features/yaml-configuration-reference.mdx |
exists |
❌ Still lists cli_backend without a deprecation/migration pointer |
docs/features/doctor-migration.mdx (or similar) |
does not exist |
❌ No coverage of DoctorContractProtocol / Finding / plugin entry point |
A repo-wide search for DoctorContractProtocol returns 0 hits in the docs repo.
Work to do
This needs both new content and updates. Per AGENTS.md, place all new pages under docs/features/ (never docs/concepts/).
A. NEW page — docs/features/doctor-runtime-migration.mdx
Agent-centric, user-friendly. Frontmatter:
---
title: "Runtime Config Migration"
sidebarTitle: "Runtime Migration"
description: "Migrate legacy cli_backend YAML to model-scoped runtime config with praisonai doctor"
icon: "stethoscope"
---
Must cover, in this order:
-
One-sentence opener. "praisonai doctor runtime detects legacy cli_backend fields in your agent YAML and migrates them to the new models.<default>.runtime field."
-
Hero Mermaid diagram (LR) using the standard palette (#8B0000, #189AB4, #10B981, #F59E0B, #6366F1, white text, #7C90A0 strokes) — show: agents.yaml (legacy cli_backend) → doctor scan → findings → --fix --execute → migrated yaml + backup.
-
Quick Start (<Steps>):
- Step "Scan only":
praisonai doctor runtime — show output snippet (WARN: Found N legacy configuration(s)…).
- Step "Preview fix (dry-run)":
praisonai doctor runtime --fix — preview of changes.
- Step "Apply fix with backup":
praisonai doctor runtime --fix --execute — note backup filename pattern <stem>.backup.<YYYYMMDD_HHMMSS>.yaml.
- Step "Target a specific file":
praisonai doctor runtime --fix --execute --file my-agents.yaml.
-
What gets migrated — show a before/after YAML pair:
Before:
cli_backend: claude-code
roles:
researcher:
cli_backend: openai-gpt
After:
models:
default:
runtime: claude-code
roles:
researcher:
models:
default:
runtime: openai-gpt
-
How it works — sequence diagram: user → praisonai doctor runtime → registry → built-in rule + plugin rules → findings → optional apply + YAML backup.
-
Flags reference table for praisonai doctor runtime (copy from the table above).
-
Writing a custom rule (plugin authors) — show DoctorContractProtocol implementation and the praisonai.doctor_contracts entry-point registration in pyproject.toml:
from praisonaiagents.runtime import DoctorContractProtocol, Finding, register_rule
class MyRule:
@property
def rule_id(self) -> str:
return "my_org.deprecate_foo"
def collect_findings(self, config):
if "foo" in config:
return [Finding(rule_id=self.rule_id, severity="warning",
message="`foo` is deprecated, use `bar` instead",
fix_description="Rename foo → bar")]
return []
def apply_fix(self, config):
if "foo" in config:
config["bar"] = config.pop("foo")
return config
[project.entry-points."praisonai.doctor_contracts"]
my_org_foo = "my_pkg.rules:MyRule"
-
Programmatic API — friendly imports:
from praisonaiagents.runtime import collect_findings, apply_fixes
Show collect_findings(yaml_dict) and apply_fixes(yaml_dict) returning a new dict.
-
Best Practices (<AccordionGroup> × 3–4): run --dry-run first, commit before --execute, keep backups, prefer entry-point registration over manual register_rule() in apps.
-
Related (<CardGroup cols={2}>): /docs/cli/doctor, /docs/features/cli-backend-protocol.
B. UPDATE — docs/cli/doctor.mdx
In the Subcommands table, add rows:
| Subcommand |
Description |
docker |
Check Docker installation and configuration |
llm-providers |
Check LLM providers configuration |
memory-store |
Check memory store backends |
metadata-store |
Check metadata store configuration |
runtime |
Check runtime configuration and migrate legacy cli_backend settings |
Add a new "Runtime Migration" example section that shows praisonai doctor runtime, … --fix, … --fix --execute, and … --file ./teams/agents.yaml. Add a sentence pointing to the new /docs/features/doctor-runtime-migration page.
C. UPDATE — docs/cli/doctor-cli.mdx
Add CLI-reference snippets for the same four subcommands plus runtime, mirroring the style of the existing Database Checks, MCP Checks, etc. sections. Document all flags from the table above.
D. UPDATE — docs/features/cli-backend-protocol.mdx
Add a top-of-page <Warning> (or <Info>) callout:
cli_backend at the agent/YAML root is now a legacy field. Prefer models.<default>.runtime. Run praisonai doctor runtime --fix --execute to migrate existing YAML automatically. See Runtime Config Migration.
E. UPDATE — docs/features/yaml-configuration-reference.mdx
In the YAML field table, mark cli_backend as "Legacy — see models.<default>.runtime and /docs/features/doctor-runtime-migration".
F. docs.json navigation
Add docs/features/doctor-runtime-migration under the Features group (never under Concepts — docs/concepts/ is human-only per AGENTS.md).
SDK source-of-truth references (read before writing)
All paths in MervinPraison/PraisonAI@main:
src/praisonai-agents/praisonaiagents/runtime/__init__.py — re-exports
src/praisonai-agents/praisonaiagents/runtime/doctor_protocol.py — Finding, DoctorContractProtocol
src/praisonai-agents/praisonaiagents/runtime/doctor_registry.py — registry + plugin discovery
src/praisonai-agents/praisonaiagents/runtime/builtin_rules.py — CliBackendMigrationRule
src/praisonai/praisonai/cli/commands/doctor.py — typer subcommands and flag wiring
src/praisonai/praisonai/cli/features/doctor/checks/runtime_migration_checks.py — actual check + backup logic
src/praisonai-agents/tests/unit/test_runtime_doctor.py — behavioral truth (use to derive examples; do not invent behavior not covered by tests)
Style requirements (from AGENTS.md)
- Place new file in
docs/features/, never in docs/concepts/.
- Mintlify frontmatter (
title, sidebarTitle, description, icon: "stethoscope").
- Hero Mermaid diagram using the standard color palette and white text.
- Use
<Steps> for Quick Start, <AccordionGroup> for Best Practices, <CardGroup> for Related.
- Friendly imports only:
from praisonaiagents.runtime import ... — no deep submodule paths.
- Agent-centric framing: open with the user's CLI command, not internal class names.
- No forbidden phrases ("In this section…", "As you can see…", etc.).
- Add the new page to
docs.json under the existing Features group.
Acceptance criteria
Context
PraisonAI PR #2075 (link) shipped a new doctor runtime configuration migration framework plus several new health-check subcommands. None of this is currently reflected in the docs.
Tracks upstream issue: MervinPraison/PraisonAI#1941
Merged commit:
2b3957a49f31dd362cdb2d0aafdafd9799a6d62dSummary of what shipped (from SDK source)
1. New runtime SDK exports
File:
src/praisonai-agents/praisonaiagents/runtime/__init__.pyNew public symbols re-exported from
praisonaiagents.runtime:DoctorContractProtocolProtocol(runtime_checkable)Findingdataclasscollect_findings()callget_default_registry()DoctorRulesRegistryregister_rule(rule)get_rules()collect_findings(config)apply_fixes(config)Source files added:
praisonaiagents/runtime/doctor_protocol.py—Finding,DoctorContractProtocolpraisonaiagents/runtime/doctor_registry.py—DoctorRulesRegistry, plugin discovery via entry pointpraisonai.doctor_contractspraisonaiagents/runtime/builtin_rules.py—CliBackendMigrationRule(built-in)2.
Findingdataclass3.
DoctorContractProtocol(the plugin contract)Plugins are discovered via the entry-point group
praisonai.doctor_contracts(importlib.metadata, withpkg_resourcesfallback).4. Built-in rule:
CliBackendMigrationRulerule_id = "cli_backend_migration"cli_backend: ...at the top level and insideroles.<role_name>of anagents.yaml.models.default.runtime: <value>(preserving the same value, with a small mapping table for known IDs:claude-code,openai-gpt,anthropic,gemini).5. New CLI:
praisonai doctor runtimeFile:
src/praisonai/praisonai/cli/commands/doctor.py--team TEXT--workflow TEXT--fix / (none)False--dry-run / --execute--dry-run--jsonFalse--deepFalse--file, -f TEXTagents.yaml/agents.yml/config.yaml/config.ymlin cwdBehavior (from
runtime_migration_checks.py):--fix: reportsWARNwith how many legacy configs found + suggestspraisonai doctor runtime --fix.--fixand--dry-run: reports preview of changes; suggests--fix --execute.--fix --execute: writes migrated YAML, leaves a<stem>.backup.<YYYYMMDD_HHMMSS>.yamlnext to the original.--fileis supplied but the file does not exist:ERROR, severity HIGH.SKIP.6. Additional new doctor subcommands shipped in the same PR
These are typer wrappers that forward to the existing doctor handler:
praisonai doctor dockerpraisonai doctor llm-providerspraisonai doctor memory-storepraisonai doctor metadata-storeAll accept
--deepand--json(exceptmetadata-store, which is--jsononly).7. Improved error messaging
doctornow distinguishes "module missing" from "module failed" in its error output (per the PR's "Bug Fixes" entry).Documentation gap analysis
Searched docs repo. Current state:
docs/cli/doctor.mdxruntime,docker,llm-providers,memory-store,metadata-storesubcommandsdocs/cli/doctor-cli.mdxdocs/features/cli-backend-protocol.mdxcli_backendis now migratable via doctordocs/features/yaml-configuration-reference.mdxcli_backendwithout a deprecation/migration pointerdocs/features/doctor-migration.mdx(or similar)DoctorContractProtocol/Finding/ plugin entry pointA repo-wide search for
DoctorContractProtocolreturns 0 hits in the docs repo.Work to do
This needs both new content and updates. Per
AGENTS.md, place all new pages underdocs/features/(neverdocs/concepts/).A. NEW page —
docs/features/doctor-runtime-migration.mdxAgent-centric, user-friendly. Frontmatter:
Must cover, in this order:
One-sentence opener. "
praisonai doctor runtimedetects legacycli_backendfields in your agent YAML and migrates them to the newmodels.<default>.runtimefield."Hero Mermaid diagram (LR) using the standard palette (
#8B0000,#189AB4,#10B981,#F59E0B,#6366F1, white text,#7C90A0strokes) — show:agents.yaml (legacy cli_backend) → doctor scan → findings → --fix --execute → migrated yaml + backup.Quick Start (
<Steps>):praisonai doctor runtime— show output snippet (WARN: Found N legacy configuration(s)…).praisonai doctor runtime --fix— preview of changes.praisonai doctor runtime --fix --execute— note backup filename pattern<stem>.backup.<YYYYMMDD_HHMMSS>.yaml.praisonai doctor runtime --fix --execute --file my-agents.yaml.What gets migrated — show a before/after YAML pair:
Before:
After:
How it works — sequence diagram: user →
praisonai doctor runtime→ registry → built-in rule + plugin rules → findings → optional apply + YAML backup.Flags reference table for
praisonai doctor runtime(copy from the table above).Writing a custom rule (plugin authors) — show
DoctorContractProtocolimplementation and thepraisonai.doctor_contractsentry-point registration inpyproject.toml:Programmatic API — friendly imports:
Show
collect_findings(yaml_dict)andapply_fixes(yaml_dict)returning a new dict.Best Practices (
<AccordionGroup>× 3–4): run--dry-runfirst, commit before--execute, keep backups, prefer entry-point registration over manualregister_rule()in apps.Related (
<CardGroup cols={2}>):/docs/cli/doctor,/docs/features/cli-backend-protocol.B. UPDATE —
docs/cli/doctor.mdxIn the Subcommands table, add rows:
dockerllm-providersmemory-storemetadata-storeruntimecli_backendsettingsAdd a new "Runtime Migration" example section that shows
praisonai doctor runtime,… --fix,… --fix --execute, and… --file ./teams/agents.yaml. Add a sentence pointing to the new/docs/features/doctor-runtime-migrationpage.C. UPDATE —
docs/cli/doctor-cli.mdxAdd CLI-reference snippets for the same four subcommands plus
runtime, mirroring the style of the existingDatabase Checks,MCP Checks, etc. sections. Document all flags from the table above.D. UPDATE —
docs/features/cli-backend-protocol.mdxAdd a top-of-page
<Warning>(or<Info>) callout:E. UPDATE —
docs/features/yaml-configuration-reference.mdxIn the YAML field table, mark
cli_backendas "Legacy — seemodels.<default>.runtimeand/docs/features/doctor-runtime-migration".F.
docs.jsonnavigationAdd
docs/features/doctor-runtime-migrationunder the Features group (never under Concepts —docs/concepts/is human-only perAGENTS.md).SDK source-of-truth references (read before writing)
All paths in
MervinPraison/PraisonAI@main:src/praisonai-agents/praisonaiagents/runtime/__init__.py— re-exportssrc/praisonai-agents/praisonaiagents/runtime/doctor_protocol.py—Finding,DoctorContractProtocolsrc/praisonai-agents/praisonaiagents/runtime/doctor_registry.py— registry + plugin discoverysrc/praisonai-agents/praisonaiagents/runtime/builtin_rules.py—CliBackendMigrationRulesrc/praisonai/praisonai/cli/commands/doctor.py— typer subcommands and flag wiringsrc/praisonai/praisonai/cli/features/doctor/checks/runtime_migration_checks.py— actual check + backup logicsrc/praisonai-agents/tests/unit/test_runtime_doctor.py— behavioral truth (use to derive examples; do not invent behavior not covered by tests)Style requirements (from
AGENTS.md)docs/features/, never indocs/concepts/.title,sidebarTitle,description,icon: "stethoscope").<Steps>for Quick Start,<AccordionGroup>for Best Practices,<CardGroup>for Related.from praisonaiagents.runtime import ...— no deep submodule paths.docs.jsonunder the existing Features group.Acceptance criteria
docs/features/doctor-runtime-migration.mdxcreated and matchesAGENTS.mdstructure (hero diagram, Quick Start, How It Works, Flags, Custom Rule, Programmatic API, Best Practices, Related).docs/cli/doctor.mdxupdated with the 5 new subcommands.docs/cli/doctor-cli.mdxupdated with new subcommand reference sections.docs/features/cli-backend-protocol.mdxupdated with deprecation/migration callout.docs/features/yaml-configuration-reference.mdxcli_backendrow updated.docs.jsonnavigation includes the new page under the Features group.docs/concepts/,docs/js/, ordocs/rust/.