-
-
Notifications
You must be signed in to change notification settings - Fork 726
Migrate from pyautogen to ag2 Library #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migrate from pyautogen to ag2 Library #1012
Conversation
WalkthroughThe changes update the project configuration and integration test documentation to rename the dependency "pyautogen" to "ag2" while keeping the version and functionality unchanged. All references to "pyautogen" in dependency declarations and installation instructions are replaced with "ag2". No code or functional logic is modified. Changes
Possibly related PRs
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @AG2AI-Admin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request is a straightforward migration aimed at transitioning the codebase from the deprecated pyautogen
library to its recommended successor, ag2
. The primary goal is to ensure ongoing compatibility and leverage improvements in the ag2
ecosystem, as there are no syntax differences between the two libraries. The changes involve updating package dependencies and relevant documentation.
Highlights
- Dependency Migration: I've updated the
pyproject.toml
file to replace thepyautogen
dependency withag2
across various sections, including the mainautogen
dependency group and optional dependencies. This ensures the project now uses the newag2
library. - Documentation Update: I've modified the
README.md
in the integration tests directory to reflect the newag2
library. This includes updating installation instructions and troubleshooting tips, guiding users topip install ag2
instead ofpyautogen
.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This PR migrates the project from the deprecated pyautogen
library to ag2
. Suggestions have been made to improve the maintainability of the pyproject.toml
by consolidating dependency definitions and to enhance the clarity of the testing documentation by providing more complete installation instructions.
@@ -91,7 +91,7 @@ call = [ | |||
] | |||
train = [] | |||
crewai = ["crewai>=0.32.0", "praisonai-tools>=0.0.22"] | |||
autogen = ["pyautogen==0.2.29", "praisonai-tools>=0.0.22", "crewai"] | |||
autogen = ["ag2==0.2.29", "praisonai-tools>=0.0.22", "crewai"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider consolidating dependency definitions. Optional dependencies (extras) are defined here in [project.optional-dependencies]
and also in [tool.poetry.extras]
(e.g., line 289). The [tool.poetry.extras]
section is a legacy way of defining extras in Poetry and maintaining both can lead to inconsistencies. To improve maintainability, remove the [tool.poetry.extras]
section entirely and rely only on [project.optional-dependencies]
.
@@ -125,7 +125,7 @@ python-dotenv = ">=0.19.0" | |||
instructor = ">=1.3.3" | |||
PyYAML = ">=6.0" | |||
mcp = ">=1.6.0" | |||
pyautogen = {version = "==0.2.29", optional = true} | |||
ag2 = {version = "==0.2.29", optional = true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency and adherence to modern packaging standards (PEP 621), define all dependencies under the [project]
table. This would mean moving dependencies from [tool.poetry.dependencies]
to [project.dependencies]
to centralize dependency management and make the pyproject.toml
easier to understand and maintain.
@@ -145,7 +145,7 @@ python -m pytest tests/integration/autogen/test_autogen_basic.py::TestAutoGenInt | |||
|
|||
### Required for AutoGen Tests: | |||
```bash | |||
pip install pyautogen | |||
pip install ag2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -251,7 +251,7 @@ To add tests for a new framework (e.g., `langchain`): | |||
``` | |||
ImportError: No module named 'autogen' | |||
``` | |||
**Solution:** Install the framework: `pip install pyautogen` | |||
**Solution:** Install the framework: `pip install ag2` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution is incomplete. While pip install ag2
might resolve the ImportError
for the autogen
module, the tests require other dependencies as well. Point to the correct installation method for all test dependencies.
**Solution:** Install the framework: `pip install ag2` | |
**Solution:** Install the framework dependencies: `pip install .[autogen]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (2)
src/praisonai/pyproject.toml (2)
128-133
: Potential duplication with an existingpyautogen
entry
ag2
is added as an optional dependency, but ifpyautogen
still exists in this same table (or in any generated lock file) poetry will consider them two distinct packages and may install both.If
pyautogen
is still present, drop it entirely:- pyautogen = {version = "==0.2.29", optional = true}
94-101
: Purgepyautogen
from lock files and regenerate dependenciesThe search still shows
pyautogen
locked in both Poetry and pip-compile outputs, which will pull in the old package alongsideag2
:
- src/praisonai/uv.lock
• name = "pyautogen" (lines 4079, 4206, 4498)
• sdist / wheel entries for pyautogen-0.2.29 (lines 4513–4515)- src/praisonai/poetry.lock
• name = "pyautogen" (line 6485)
• wheel / tar.gz entries for pyautogen-0.5.3 (lines 6493–6494)
• extras autogen still includespyautogen
(line 9720)Please regenerate your lock files to pick up the updated
ag2
extras and drop all references topyautogen
:
- Run
poetry lock
(orpoetry lock --no-update
)- Re-run your pip-compile or uv-tooling step to rebuild
uv.lock
After that, double-check CI configs, Dockerfiles, docs, etc., for any hard-coded
pyautogen
mentions.
🧹 Nitpick comments (2)
src/praisonai/pyproject.toml (1)
289-290
: Keep extras list alphabetically sorted for readabilityPure nit: while touching this line you could sort the extras alphabetically to keep long lists tidy.
-autogen = ["ag2", "praisonai-tools", "crewai"] +autogen = ["ag2", "crewai", "praisonai-tools"]src/praisonai/tests/integration/README.md (1)
254-255
: Stay consistent in troubleshooting sectionGood catch replacing the package name, but consider adding a note that
ag2
provides theautogen
module (if that’s the case) to avoid confusion for new contributors.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/praisonai/pyproject.toml
(3 hunks)src/praisonai/tests/integration/README.md
(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
src/praisonai/pyproject.toml (3)
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-agents/CLAUDE.md:0-0
Timestamp: 2025-07-18T14:39:55.954Z
Learning: Applies to src/praisonai-agents/praisonaiagents/agent/**/*.py : Use the `Agent` class from `praisonaiagents/agent/` for creating agents, with parameters such as `name`, `role`, `goal`, `backstory`, `llm`, `self_reflect`, `min_reflect`, `max_reflect`, `tools`, `guardrail`, and `max_guardrail_retries`.
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-agents/CLAUDE.md:0-0
Timestamp: 2025-07-18T14:39:55.954Z
Learning: Applies to src/praisonai-agents/praisonaiagents/mcp/**/*.py : MCP integration code in `praisonaiagents/mcp/` should implement server-side tool protocol, SSE support, and dynamic tool registration.
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-agents/CLAUDE.md:0-0
Timestamp: 2025-07-18T14:39:55.954Z
Learning: Applies to src/praisonai-agents/praisonaiagents/**/*.py : Gracefully degrade functionality for optional dependencies (e.g., memory, knowledge, LLM providers) if they are not installed.
src/praisonai/tests/integration/README.md (5)
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-agents/CLAUDE.md:0-0
Timestamp: 2025-07-18T14:39:55.954Z
Learning: Applies to src/praisonai-agents/tests/**/*.py : All test files should be placed in the `tests/` directory and demonstrate specific usage patterns, serving as both test and documentation.
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-agents/CLAUDE.md:0-0
Timestamp: 2025-07-18T14:39:55.954Z
Learning: Applies to src/praisonai-agents/praisonaiagents/llm/**/*.py : LLM integration code in `praisonaiagents/llm/` should use the unified LiteLLM wrapper and support multiple providers (OpenAI, Anthropic, Gemini, DeepSeek, Ollama).
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-ts/.windsurfrules:0-0
Timestamp: 2025-07-18T14:40:53.720Z
Learning: Applies to src/praisonai-ts/src/tools/README.md : The 'src/tools/README.md' file should provide documentation for tool developers
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-agents/CLAUDE.md:0-0
Timestamp: 2025-07-18T14:39:55.954Z
Learning: Applies to src/praisonai-agents/praisonaiagents/agent/**/*.py : Use the `Agent` class from `praisonaiagents/agent/` for creating agents, with parameters such as `name`, `role`, `goal`, `backstory`, `llm`, `self_reflect`, `min_reflect`, `max_reflect`, `tools`, `guardrail`, and `max_guardrail_retries`.
Learnt from: CR
PR: MervinPraison/PraisonAI#0
File: src/praisonai-agents/CLAUDE.md:0-0
Timestamp: 2025-07-18T14:39:55.954Z
Learning: Applies to src/praisonai-agents/praisonaiagents/**/*.py : Gracefully degrade functionality for optional dependencies (e.g., memory, knowledge, LLM providers) if they are not installed.
🔇 Additional comments (1)
src/praisonai/tests/integration/README.md (1)
148-149
: Verify import path after package renameThe install instruction now points to
ag2
, but the surrounding docs – and likely the tests – still refer to the module nameautogen
.
Confirm thatimport autogen
still works after installingag2
; if not, update test code and docs accordingly.
@claude review these changes, will this impact other areas ? |
Claude encountered an error —— View job
I'll analyze this and get back to you. |
2 similar comments
Claude encountered an error —— View job
I'll analyze this and get back to you. |
Claude encountered an error —— View job
I'll analyze this and get back to you. |
@@ -91,7 +91,7 @@ call = [ |
@claude review these changes again , make those changes in the above branch, based on the proposal if no changes exists in the provided branch. Also create a new branch instead if no original source branch exists |
Claude encountered an error —— View job
I'll analyze this and get back to you. |
Hey there! This is AG2 👋
First of all, thank you for using pyautogen! We've seen you're using pyautogen, and we're here to help you migrate to ag2.
This pull request is designed to help update this codebase by smoothly transitioning from the
pyautogen
library to the newag2
library.Why the change?
pyautogen
is being deprecated, andag2
is now the recommended successor for ongoing development.The good news is, there is no syntax difference between pyautogen and ag2 – this migration primarily involves updating library imports and usage.
This update will ensure the project stays compatible with the latest tools and can benefit from all the improvements in the ag2 ecosystem.
Could you please take a moment to review and merge this at your earliest convenience? Your collaboration is much appreciated! Thank you!
Summary by CodeRabbit