Skip to content

docs: follow-up to #579 B.1 — verify lazy exports, migrate remaining deep imports, and bring affected pages up to AGENTS.md spec #801

Description

@MervinPraison

Context

PraisonAI PR #2165fix(sdk): lazy top-level re-exports for docs-friendly imports (PraisonAIDocs #579 B.1) — merged into main at 2026-06-23T07:23:12Z. It adds the following symbols to praisonaiagents/__init__.py _LAZY_IMPORTS so docs can stop using deep import paths:

Module New top-level symbols
workflows if_, include, Include, MAX_NESTING_DEPTH, YAMLWorkflowParser
knowledge KnowledgeStoreProtocol, ScopeRequiredError, BackendNotAvailableError, FileTracker, IndexResult, CorpusStats
skills validate, validate_metadata, discover_skills, load_skill, EnforcementLevel, SkillState
memory AutoMemory, ChromaMemory

The docs side of the friendly-import migration shipped earlier in PR #798, #799, and #800before the SDK side had landed. The imports were dead-on-paper until 07:23 UTC today; they now actually resolve.

This issue tracks the loose ends.


A. Sanity check — verify friendly imports now resolve at runtime

Quick smoke check the next agent must run before anything else. All of these must print ok:

python -c "from praisonaiagents import AutoMemory, ChromaMemory; print('ok')"
python -c "from praisonaiagents import if_, include, Include, MAX_NESTING_DEPTH, YAMLWorkflowParser; print('ok')"
python -c "from praisonaiagents import KnowledgeStoreProtocol, ScopeRequiredError, BackendNotAvailableError; print('ok')"
python -c "from praisonaiagents import FileTracker, IndexResult, CorpusStats; print('ok')"
python -c "from praisonaiagents import validate, validate_metadata, discover_skills, load_skill, EnforcementLevel, SkillState; print('ok')"

If any fails, file a SDK sub-issue in MervinPraison/PraisonAI per AGENTS.md §1.3 (SDK Source Verification) before continuing — do not keep deep imports in docs as a workaround.

Files that should be re-grepped to confirm no praisonaiagents.{memory,skills,knowledge,workflows,planning} deep imports remain in docs/features/:

rg "from praisonaiagents\.(workflows|memory|skills|knowledge|planning)" docs/features/

Current grep at the time this issue was filed returned 5 matches across 2 files (covered in section B below).


B. Remaining deep imports — MIGRATE to friendly form

B.1 docs/features/prompt-caching.mdxMemory is now top-level

Memory was already re-exported from praisonaiagents/__init__.py before PR #2165 (the lazy map already had 'Memory': ('praisonaiagents.memory.memory', 'Memory')). The page never got swept.

Line Current (forbidden per AGENTS.md §6.1, §5.2) Fix to
52 from praisonaiagents.memory import Memory from praisonaiagents import Memory
145 from praisonaiagents.memory import Memory from praisonaiagents import Memory

B.2 docs/features/custom-memory-adapters.mdx — needs upstream SDK exports

This page uses three symbols that are not yet in _LAZY_IMPORTS:

Line Symbol used
54 register_memory_adapter
129 register_memory_adapter, get_memory_adapter
166 list_memory_adapters

Per AGENTS.md §6.1 the next agent must not keep deep imports in docs — instead file a sub-issue against MervinPraison/PraisonAI requesting register_memory_adapter, get_memory_adapter, and list_memory_adapters be added to praisonaiagents/__init__.py _LAZY_IMPORTS (target path: praisonaiagents.memory.adapters). Once that lands, refactor the three import lines above.

Reference the existing pattern from PR #2165:

'register_memory_adapter': ('praisonaiagents.memory.adapters', 'register_memory_adapter'),
'get_memory_adapter': ('praisonaiagents.memory.adapters', 'get_memory_adapter'),
'list_memory_adapters': ('praisonaiagents.memory.adapters', 'list_memory_adapters'),

Until that SDK PR is merged, leave the imports as-is and flag the page in the PR description as blocked-on-SDK rather than silently masking the gap.


C. Pages newly relying on the lazy exports — bring up to AGENTS.md spec

Each page below uses one or more PR #2165 symbols. Spot checks against the AGENTS.md template (§2) show structural gaps. Per AGENTS.md §1.2 (SDK-First cycle), the next agent must read the SDK source first, then rewrite each page top-to-bottom.

C.1 docs/features/incremental-indexing.mdx — uses FileTracker, IndexResult, CorpusStats

SDK source to read first:

  • praisonaiagents/knowledge/indexing.py (defines FileTracker, IndexResult, CorpusStats)
  • praisonaiagents/knowledge/knowledge.py (the Knowledge.index() entry point)

Current gaps vs AGENTS.md template (§2, §9.1):

  • Frontmatter missing sidebarTitle
  • H1 # Incremental Indexing present (Mintlify convention: title goes in frontmatter only, do not repeat as H1)
  • No hero Mermaid diagram — violates §1.9 create all these modules #10 and §3.3
  • ## Overview section is not in the template — replace with the one-sentence intro pattern from §6.2
  • Quick Start is a raw fenced block — must be wrapped in <Steps> with at least 2 <Step> children (Simple → With Config) per §4.1
  • No Configuration Options table sourced from IndexResult / CorpusStats dataclasses per §5.4 / §7.2
  • No Common Patterns section
  • No Best Practices <AccordionGroup> per §4.1
  • No Related <CardGroup> per §4.1 (link to /features/knowledge-backends, /features/knowledge at minimum)
  • Missing user-interaction sequenceDiagram per §1.1 create all these modules #10 / §3.4

Hero diagram suggestion (graph LR with standard §3.1 palette):

graph LR
    A[📁 Files] --> B[🔍 FileTracker]
    B --> C{Changed?}
    C -->|Yes| D[📥 Index]
    C -->|No| E[⏭ Skip]
    D --> F[📊 CorpusStats]
    E --> F

    classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
    classDef process fill:#F59E0B,stroke:#7C90A0,color:#fff
    classDef result fill:#10B981,stroke:#7C90A0,color:#fff

    class A input
    class B,C,D,E process
    class F result
Loading

C.2 docs/features/knowledge-backends.mdx — uses KnowledgeStoreProtocol, ScopeRequiredError, BackendNotAvailableError

SDK source to read first:

  • praisonaiagents/knowledge/protocols.py

Action: verify the page has:

  • A hero Mermaid diagram
  • An agent-centric Quick Start (from praisonaiagents import Agent enabling a knowledge backend with True first, then dict, then KnowledgeStoreProtocol implementation last) — precedence ladder per §7.1
  • A Configuration Options table extracted from KnowledgeStoreProtocol field annotations / docstrings
  • Brief mentions of the two error types (ScopeRequiredError, BackendNotAvailableError) with one-line "raised when…" descriptions
  • A Related <CardGroup> linking to /features/incremental-indexing and /features/advanced-memory

C.3 docs/features/hermes-openclaw-skills-import.mdx — uses discover_skills, validate, load_skill

SDK source to read first:

  • praisonaiagents/skills/ (the skill loader + validator)

Action: confirm the first runnable example on the page is an agent-centric Agent(..., skills=[...]) snippet before showing discover_skills / load_skill (which are extension-API utilities, not the typical user path). Per AGENTS.md §1.1 #9 the agent-centric example must come first.

C.4 docs/features/skill-capability-gates.mdx — uses EnforcementLevel, SkillState

SDK source to read first:

  • praisonaiagents/skills/ (look for capability gate definitions, EnforcementLevel enum, SkillState enum)

Action: add (if missing) a small enum reference table showing each EnforcementLevel and SkillState value with a one-line description. Verify Configuration Options table covers every field of the relevant config dataclass per §7.2.

C.5 docs/features/advanced-memory.mdx — uses AutoMemory

SDK source to read first:

  • praisonaiagents/memory/auto_memory.py (or wherever AutoMemory is defined)
  • praisonaiagents/config/feature_configs.py for the MemoryConfig dataclass

Action: ensure the page leads with the precedence-ladder agent-centric example per §7.1 (memory=Truememory="auto"memory={...}memory=AutoMemory(...)memory=MemoryConfig(...)). This was flagged as B.2 in the original #579 — confirm it actually got done.

C.6 docs/features/resource-lifecycle.mdx — uses ChromaMemory

SDK source to read first:

  • praisonaiagents/memory/adapters/factories.py (PR #2165 maps ChromaMemory to create_chroma_memory_adapter — verify the docs example matches this factory semantics, not a constructor)

Important: ChromaMemory is re-exported as a factory function (create_chroma_memory_adapter), not a class. The docs example at resource-lifecycle.mdx:122 must use it as ChromaMemory(...) returning an adapter instance — confirm the page reads correctly as a function call and not as class ChromaMemory: instantiation.

C.7 docs/features/conditional-branching.mdx, nested-workflows.mdx, modular-recipes.mdx, yaml-workflows.mdx, multi-agent-pipelines.mdx — use if_, Include, include, MAX_NESTING_DEPTH, YAMLWorkflowParser

These already use friendly imports post-#800. Per AGENTS.md §1.9 #2 the next agent must still read the SDK source for each before editing:

  • praisonaiagents/workflows/ (entry point + if_, include, Include)
  • praisonaiagents/workflows/yaml_parser.py (for YAMLWorkflowParser)

Confirm each page has: hero diagram, agent-centric Quick Start, Configuration Options table, Related <CardGroup>. The MAX_NESTING_DEPTH constant should be documented as a one-line module-level constant with its default value pulled from SDK (do not duplicate — link to SDK reference per §2 template).


D. Process the next agent MUST follow

Non-negotiable rules from AGENTS.md — call them out explicitly so the next agent does not skip steps:

  1. Read AGENTS.md in full before starting (§1.9 create all these missing modules #1).
  2. Read the SDK source for each feature before editing its doc (§1.2 SDK-First cycle, §1.9 create all these missing modules #2).
    • Lazy export map: praisonaiagents/__init__.py _LAZY_IMPORTS
    • Feature configs: praisonaiagents/config/feature_configs.py
    • Module roots: praisonaiagents/{memory,skills,knowledge,workflows}/
  3. Work on the feature branch claude/admiring-euler-urm5kn (do not push to main).
  4. One feature per commit so the diff stays reviewable.
  5. Validate docs.json after any sidebar entry change (§1.9 create all these modules #8) — must remain valid JSON, must add new pages under the Features group, never under Concepts (§1.8 rule 4).
  6. Open a draft PR when finished (per remote-execution-environment policy in this repo).
  7. NEVER create or modify docs/concepts/ (§1.8 rule 1) — human-approved only.

Style guardrails (§6)

  • One-sentence section intros — no padding.
  • Active voice, direct language.
  • Forbidden phrases (§6.3) — do not use: "In this section…", "As you can see…", "It's important to note…", "Please note…", "Let's take a look at…", "The following example shows…".
  • Code examples must run as-is (§5.1) — no your-key-here placeholders.
  • Every page user-focused, not SDK-focused (§1.1 create all these missing modules #6, create all these modules #9).
  • Friendly imports only (§6.1) — from praisonaiagents import …, never from praisonaiagents.{submodule} import ….

Quality checklist before committing each page (§9)

  • Frontmatter has title, sidebarTitle, description, icon (§8)
  • Hero Mermaid diagram with standard colors (§3.1)
  • Quick Start uses <Steps> with at least 2 <Step> children (Simple + With Config)
  • Configuration Options table matches SDK dataclass exactly (§7.2)
  • Common Patterns section with 2-3 practical examples
  • Best Practices uses <AccordionGroup> (§4.1)
  • Related uses <CardGroup cols={2}> with 2 contextually-relevant <Card> children
  • First code block uses from praisonaiagents import Agent
  • No from praisonaiagents.{submodule} import … (friendly imports only)
  • All imports verified at runtime against SDK __init__.py _LAZY_IMPORTS
  • Page is user-focused, not SDK-focused
  • No # Heading H1 inside the body — title belongs to frontmatter only

E. Scope summary

Bucket Files affected
Runtime sanity check on new exports 5 one-liners (section A)
Friendly-imports migration (Memory) 1 (prompt-caching.mdx, 2 lines)
SDK sub-issue (memory adapter registry exports) Upstream MervinPraison/PraisonAI
AGENTS.md compliance rewrite 1 (incremental-indexing.mdx)
AGENTS.md compliance audit 6 (knowledge-backends.mdx, hermes-openclaw-skills-import.mdx, skill-capability-gates.mdx, advanced-memory.mdx, resource-lifecycle.mdx, conditional-branching.mdx, nested-workflows.mdx, modular-recipes.mdx, yaml-workflows.mdx, multi-agent-pipelines.mdx)
ChromaMemory factory-vs-class semantics check 1 (resource-lifecycle.mdx)

Suggested order: A (sanity) → B.1 (1-file friendly-import fix) → B.2 (file SDK sub-issue) → C.1 (full rewrite of incremental-indexing.mdx as the canonical example) → C.2–C.7 (audit/touch-up sweep).


F. References

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeTrigger Claude Code analysisdocumentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions