Skip to content

fix: remove dead AutoGen adapter registration to prevent heavy imports#2115

Open
praisonai-triage-agent[bot] wants to merge 1 commit into
mainfrom
claude/issue-2113-20260620-1609
Open

fix: remove dead AutoGen adapter registration to prevent heavy imports#2115
praisonai-triage-agent[bot] wants to merge 1 commit into
mainfrom
claude/issue-2113-20260620-1609

Conversation

@praisonai-triage-agent

@praisonai-triage-agent praisonai-triage-agent Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #2113

Summary

Removed dead AutoGen adapter registration that triggers heavy praisonai_tools import (~3200ms overhead) on every AgentsGenerator initialization.

Changes

  • Removed register_builtin_autogen_adapters() call from AgentsGenerator.init
  • Kept all deprecated methods for backward compatibility
  • AutoGen support remains unaffected (provided by framework_adapters/)

Impact

  • Before: Every AgentsGenerator construction imports praisonai_tools (if installed)
  • After: No heavy imports on the hot path, ~3200ms faster initialization

Testing

  • Verified backward compatibility - all deprecated methods still exist
  • Confirmed praisonai_tools is no longer imported on AgentsGenerator instantiation
  • AutoGen framework integration unchanged (via framework_adapters/)

Generated with Claude Code

Co-authored-by: MervinPraison MervinPraison@users.noreply.github.com

Summary by CodeRabbit

  • Refactor
    • Improved internal architecture for tool management and system initialization.

Remove dead AutoGen adapter registration that triggers heavy praisonai_tools import.
The registration was never used by runtime code and caused ~3200ms import overhead.

- Removed register_builtin_autogen_adapters() call from AgentsGenerator.__init__
- Kept deprecated methods for backward compatibility
- AutoGen support unaffected (provided by framework_adapters/)

Co-authored-by: MervinPraison <MervinPraison@users.noreply.github.com>
@MervinPraison

Copy link
Copy Markdown
Owner

@coderabbitai review

@MervinPraison

Copy link
Copy Markdown
Owner

/review

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more β†’

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account β†’

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us β†’

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor
βœ… Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f46c16e-3795-4375-b874-80654bb5f9d0

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 5f39d66 and 413fd36.

πŸ“’ Files selected for processing (1)
  • src/praisonai/praisonai/agents_generator.py
πŸ’€ Files with no reviewable changes (1)
  • src/praisonai/praisonai/agents_generator.py

πŸ“ Walkthrough

Walkthrough

Removes the register_builtin_autogen_adapters call from AgentsGenerator.__init__, eliminating an eager import of heavy praisonai_tools dependencies on every generator construction. The deprecated public shim method on ToolRegistry is preserved; the canonical AutoGen integration in framework_adapters/ is unaffected.

Changes

Remove dead AutoGen adapter registration

Layer / File(s) Summary
Drop eager AutoGen adapter registration
src/praisonai/praisonai/agents_generator.py
Removes the self.tool_registry.register_builtin_autogen_adapters(...) call from AgentsGenerator.__init__, which was a dead store into ToolRegistry._autogen_adapters with no runtime reader outside deprecated shim methods.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • MervinPraison/PraisonAI#1448: Refactors agents_generator.py around the per-instance ToolRegistry and builtin AutoGen adapter registration β€” the same code area this PR modifies.
  • MervinPraison/PraisonAI#1505: Modifies AgentsGenerator's tool-registry initialization to introduce a shared ToolResolver wired into tool_registry, directly overlapping with this change.
  • MervinPraison/PraisonAI#1726: Alters how ToolResolver is wired and used in agents_generator.py, including caching/lookup behavior connected to the same initialization path.

Suggested reviewers

  • MervinPraison

πŸ‡ One line fewer to carry,
The heavy import is gone!
No crewai tools to tarry,
The hot path hops along.
Dead stores begone β€” the warren is swift! 🌿

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title clearly describes the main change: removing dead AutoGen adapter registration that triggers unnecessary heavy imports during initialization.
Linked Issues check βœ… Passed The code change directly addresses issue #2113 by removing the dead registration call that triggers heavy praisonai_tools imports while preserving backward compatibility and AutoGen support.
Out of Scope Changes check βœ… Passed The change is narrowly scoped to removing the single unnecessary call to register_builtin_autogen_adapters() from AgentsGenerator.init, with no extraneous modifications.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ“ Generate docstrings
  • Create stacked PR
  • Commit on current branch
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-2113-20260620-1609

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MervinPraison

Copy link
Copy Markdown
Owner

@copilot Do a thorough review of this PR. Read ALL existing reviewer comments above from Qodo, Coderabbit, and Gemini first β€” incorporate their findings.

Review areas:

  1. Bloat check: Are changes minimal and focused? Any unnecessary code or scope creep?
  2. Security: Any hardcoded secrets, unsafe eval/exec, missing input validation?
  3. Performance: Any module-level heavy imports? Hot-path regressions?
  4. Tests: Are tests included? Do they cover the changes adequately?
  5. Backward compat: Any public API changes without deprecation?
  6. Code quality: DRY violations, naming conventions, error handling?
  7. Address reviewer feedback: If Qodo, Coderabbit, or Gemini flagged valid issues, include them in your review
  8. Suggest specific improvements with code examples where possible

@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown

Greptile Summary

Removes a single deprecated method call (register_builtin_autogen_adapters) from AgentsGenerator.__init__ that was eagerly importing praisonai_tools on every construction, causing ~3200ms startup overhead. AutoGen support is now handled entirely through the framework_adapters/autogen_adapter.py module.

  • The removed call was already marked deprecated in ToolRegistry, and the framework_adapters/autogen_adapter.py file already provides the modern AutoGen integration path.
  • The ToolRegistry instance is still created and wired up; only the no-longer-needed built-in adapter pre-registration is dropped, making AgentsGenerator construction significantly faster when praisonai_tools is installed.

Confidence Score: 5/5

Safe to merge β€” removes a single deprecated method call that was already a no-op for the live AutoGen code path.

The deleted line called a method explicitly marked deprecated whose functionality was already superseded by framework_adapters/autogen_adapter.py. No other code in agents_generator.py references _autogen_adapters or the old registration path, confirming the call was dead. The ToolRegistry itself is still created and fully wired, so nothing downstream loses its dependency.

No files require special attention.

Important Files Changed

Filename Overview
src/praisonai/praisonai/agents_generator.py Removes the deprecated register_builtin_autogen_adapters call from __init__; no other autogen-adapter usages remain in this file, and the ToolRegistry is still properly initialized.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Caller
    participant AgentsGenerator
    participant ToolRegistry
    participant inbuilt_tools
    participant praisonai_tools

    Note over Caller,praisonai_tools: Before (removed line)
    Caller->>AgentsGenerator: __init__()
    AgentsGenerator->>ToolRegistry: ToolRegistry()
    AgentsGenerator->>ToolRegistry: register_builtin_autogen_adapters()
    ToolRegistry->>inbuilt_tools: _get_autogen_tools()
    inbuilt_tools->>praisonai_tools: import praisonai_tools (~3200ms)
    praisonai_tools-->>ToolRegistry: tools module
    ToolRegistry-->>AgentsGenerator: adapters registered (deprecated)

    Note over Caller,praisonai_tools: After (this PR)
    Caller->>AgentsGenerator: __init__()
    AgentsGenerator->>ToolRegistry: ToolRegistry()
    Note over AgentsGenerator,ToolRegistry: No heavy import triggered
    AgentsGenerator-->>Caller: ready (fast path)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Caller
    participant AgentsGenerator
    participant ToolRegistry
    participant inbuilt_tools
    participant praisonai_tools

    Note over Caller,praisonai_tools: Before (removed line)
    Caller->>AgentsGenerator: __init__()
    AgentsGenerator->>ToolRegistry: ToolRegistry()
    AgentsGenerator->>ToolRegistry: register_builtin_autogen_adapters()
    ToolRegistry->>inbuilt_tools: _get_autogen_tools()
    inbuilt_tools->>praisonai_tools: import praisonai_tools (~3200ms)
    praisonai_tools-->>ToolRegistry: tools module
    ToolRegistry-->>AgentsGenerator: adapters registered (deprecated)

    Note over Caller,praisonai_tools: After (this PR)
    Caller->>AgentsGenerator: __init__()
    AgentsGenerator->>ToolRegistry: ToolRegistry()
    Note over AgentsGenerator,ToolRegistry: No heavy import triggered
    AgentsGenerator-->>Caller: ready (fast path)
Loading

Reviews (1): Last reviewed commit: "fix: remove unreferenced dead code in co..." | Re-trigger Greptile

@MervinPraison

Copy link
Copy Markdown
Owner

@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Focus ONLY on Python packages (praisonaiagents, praisonai). Do NOT modify praisonai-rust or praisonai-ts. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding.

Phase 1: Review per AGENTS.md

  1. Protocol-driven: check heavy implementations vs core SDK
  2. Backward compatible: ensure zero feature regressions
  3. Performance: no hot-path regressions

Phase 2: FIX Valid Issues
4. For any VALID bugs or architectural flaws found by Gemini, CodeRabbit, Qodo, Copilot, or any other reviewer: implement the fix
5. Push all code fixes directly to THIS branch (do NOT create a new PR)
6. Comment a summary of exact files modified and what you skipped

Phase 3: Final Verdict
7. If all issues are resolved, approve the PR / close the Issue
8. If blocking issues remain, request changes / leave clear action items

@praisonai-triage-agent

praisonai-triage-agent Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Claude finished @MervinPraison's task β€”β€” View job


Architecture Review Complete βœ…

Todo List:

  • Read AGENTS.md architecture guidelines
  • Review the code change in detail
  • Analyze all reviewer feedback (Qodo, CodeRabbit, Copilot, Greptile)
  • Check for architecture violations per AGENTS.md
  • Fix any valid issues found
  • Provide final verdict

Phase 1: Architecture Review per AGENTS.md

1. Protocol-driven Design βœ…

The removed line was calling register_builtin_autogen_adapters() which triggered heavy imports of praisonai_tools. This violates the principle of keeping heavy implementations out of the core SDK hot path. The change correctly moves toward a protocol-driven design where AutoGen support is now properly handled via framework_adapters/autogen_adapter.py.

2. Backward Compatibility βœ…

  • All deprecated methods in ToolRegistry remain intact for backward compatibility
  • AutoGen functionality continues to work through the modern framework_adapters/ path
  • The _autogen_adapters attribute is still supported in the deprecated methods

3. Performance βœ…

  • Removes ~3200ms import overhead on the hot path
  • No longer eagerly imports praisonai_tools on every AgentsGenerator construction
  • Verified the change works correctly without the removed line

Phase 2: Reviewer Feedback Analysis

CodeRabbit βœ…

  • Pre-merge checks all passed
  • Correctly identified the change removes dead code with no runtime readers
  • No issues raised

Greptile βœ…

  • Confidence Score: 5/5 - "Safe to merge"
  • Confirmed the removed call was already deprecated and superseded by framework_adapters/autogen_adapter.py
  • No issues raised

Qodo βœ…

  • Reviews paused for user (subscription issue, not code issue)
  • No technical issues raised

Copilot

  • No review provided yet

Phase 3: Final Verdict

βœ… APPROVED - Ready to Merge

This is a clean, focused performance improvement that:

  1. Removes a deprecated, dead registration call that served no runtime purpose
  2. Eliminates ~3200ms of unnecessary import overhead on the hot path
  3. Maintains full backward compatibility through preserved deprecated methods
  4. Follows AGENTS.md principles by keeping heavy implementations out of the core initialization path
  5. AutoGen support remains fully functional via the modern framework_adapters/ architecture

No code fixes needed - the change is architecturally sound and all reviewer feedback confirms it's safe to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dead AutoGen adapter registration triggers heavy praisonai_tools import on every AgentsGenerator init

1 participant