-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: implement unified deprecation management system #1192
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,238 @@ | ||
| # Migration Guide | ||
|
|
||
| This guide documents breaking changes and deprecations in PraisonAI, with migration instructions and timelines. | ||
|
|
||
| ## Version Strategy | ||
|
|
||
| PraisonAI follows [Semantic Versioning](https://semver.org/): | ||
| - **Major versions** (e.g., 2.0.0): Breaking changes, deprecated features removed | ||
| - **Minor versions** (e.g., 1.5.0): New features, deprecations introduced | ||
| - **Patch versions** (e.g., 1.5.1): Bug fixes, no API changes | ||
|
|
||
| **Deprecation Timeline:** | ||
| - Features are deprecated in **minor** releases | ||
| - Deprecated features are removed in the **next major** release | ||
| - Deprecation warnings include the removal version | ||
|
|
||
| ## Current Deprecations (v1.0.0) | ||
|
|
||
| ### Agent Parameters → Consolidated Config Objects | ||
|
|
||
| **Status:** Deprecated in v1.0.0, will be removed in v2.0.0 | ||
|
|
||
| Old standalone parameters have been consolidated into config objects for better organization and type safety. | ||
|
|
||
| #### ❌ Old Way (Deprecated) | ||
| ```python | ||
| from praisonaiagents import Agent | ||
|
|
||
| agent = Agent( | ||
| name="coder", | ||
| allow_code_execution=True, # ❌ Deprecated | ||
| code_execution_mode="unsafe", # ❌ Deprecated | ||
| auto_save="my_session", # ❌ Deprecated | ||
| rate_limiter=my_limiter, # ❌ Deprecated | ||
| allow_delegation=True, # ❌ Deprecated | ||
| verification_hooks=[my_hook], # ❌ Deprecated | ||
| llm="gpt-4o-mini" # ❌ Deprecated | ||
| ) | ||
| ``` | ||
|
|
||
| #### ✅ New Way (Recommended) | ||
| ```python | ||
| from praisonaiagents import Agent, ExecutionConfig, MemoryConfig | ||
| from praisonaiagents.agent.autonomy import AutonomyConfig | ||
|
|
||
| agent = Agent( | ||
| name="coder", | ||
| model="gpt-4o-mini", # ✅ Use 'model' instead of 'llm' | ||
| handoffs=[reviewer_agent], # ✅ Use 'handoffs' instead of 'allow_delegation' | ||
| execution=ExecutionConfig( | ||
| code_execution=True, | ||
| code_mode="unsafe", | ||
| rate_limiter=my_limiter | ||
| ), | ||
| memory=MemoryConfig(auto_save="my_session"), | ||
| autonomy=AutonomyConfig(verification_hooks=[my_hook]) | ||
| ) | ||
| ``` | ||
|
|
||
| **Migration Steps:** | ||
| 1. Replace `llm=` with `model=` | ||
| 2. Replace `allow_delegation=True` with `handoffs=[agent_list]` | ||
| 3. Group execution-related params into `ExecutionConfig` | ||
| 4. Group memory params into `MemoryConfig` | ||
| 5. Group autonomy params into `AutonomyConfig` | ||
|
|
||
| ### Task Parameters | ||
|
|
||
| **Status:** Deprecated in v1.0.0, will be removed in v2.0.0 | ||
|
|
||
| #### Task Callback → on_task_complete | ||
| ```python | ||
| # ❌ Old Way | ||
| task = Task(callback=my_function) | ||
|
|
||
| # ✅ New Way | ||
| task = Task(on_task_complete=my_function) | ||
| ``` | ||
|
|
||
| #### Task Guardrail → guardrails | ||
| ```python | ||
| # ❌ Old Way | ||
| task = Task(guardrail=my_guardrail) | ||
|
|
||
| # ✅ New Way | ||
| task = Task(guardrails=my_guardrail) | ||
| ``` | ||
|
|
||
| ### Class Renames | ||
|
|
||
| **Status:** Deprecated in v1.0.0, will be removed in v2.0.0 | ||
|
|
||
| #### AutonomySignal → EscalationSignal | ||
| ```python | ||
| # ❌ Old Way | ||
| from praisonaiagents.agent.autonomy import AutonomySignal | ||
|
|
||
| # ✅ New Way | ||
| from praisonaiagents.escalation.types import EscalationSignal | ||
| ``` | ||
|
|
||
| ### Directory Structure Changes | ||
|
|
||
| **Status:** Deprecated in v1.0.0, will be removed in v2.0.0 | ||
|
|
||
| #### Data Directory Migration | ||
| ```bash | ||
| # Old location (deprecated) | ||
| ~/.praisonai-data/ | ||
|
|
||
| # New location (recommended) | ||
| ~/.praisonai/ | ||
|
|
||
| # Migration command | ||
| praisonai migrate-data | ||
| ``` | ||
|
|
||
| ### Process Workflow → Workflow Class | ||
|
|
||
| **Status:** Deprecated in v1.0.0, will be removed in v2.0.0 | ||
|
|
||
| ```python | ||
| # ❌ Old Way | ||
| from praisonaiagents import process | ||
| result = process='workflow' | ||
|
|
||
| # ✅ New Way | ||
| from praisonaiagents import Workflow | ||
| workflow = Workflow(steps=[...]) | ||
| result = workflow.start() | ||
| ``` | ||
|
|
||
| ### BotOS Platform Changes | ||
|
|
||
| **Status:** Deprecated in v1.0.0, will be removed in v2.0.0 | ||
|
|
||
| #### BotApprovalBackend → Platform-Specific Approvals | ||
| ```python | ||
| # ❌ Old Way | ||
| from praisonai.bots._approval import BotApprovalBackend | ||
|
|
||
| # ✅ New Way - Use platform-specific approvals | ||
| from praisonai.bots.approval import SlackApproval, TelegramApproval, DiscordApproval | ||
| ``` | ||
|
|
||
| ### LLM Module Changes | ||
|
|
||
| **Status:** Deprecated in v1.0.0, will be removed in v2.0.0 | ||
|
|
||
| #### Embedding Function | ||
| ```python | ||
| # ❌ Old Way | ||
| from praisonai.llm import embedding | ||
| result = embedding(text) | ||
|
|
||
| # ✅ New Way | ||
| from praisonai import embed | ||
| # or | ||
| from praisonai.capabilities import embed | ||
| result = embed(text) # Returns EmbeddingResult with metadata | ||
| ``` | ||
|
|
||
| ## Previous Versions | ||
|
|
||
| ### v0.9.x → v1.0.0 | ||
|
|
||
| No breaking changes. All v0.9.x code continues to work with deprecation warnings. | ||
|
|
||
| ## Migration Tools | ||
|
|
||
| ### Automated Migration (Future) | ||
| We're working on automated migration tools: | ||
|
|
||
| ```bash | ||
| # Check for deprecated usage (Future) | ||
| praisonai check-deprecations | ||
|
|
||
| # Auto-migrate code (Future) | ||
| praisonai migrate --from=1.0 --to=2.0 | ||
| ``` | ||
|
|
||
| ### Manual Migration Checklist | ||
|
|
||
| Before upgrading to v2.0.0: | ||
|
|
||
| - [ ] Update Agent constructor parameters to use config objects | ||
| - [ ] Replace `llm=` with `model=` | ||
| - [ ] Update `allow_delegation` to `handoffs` | ||
| - [ ] Update task parameters (`callback` → `on_task_complete`, `guardrail` → `guardrails`) | ||
| - [ ] Replace `AutonomySignal` with `EscalationSignal` | ||
| - [ ] Migrate data directory with `praisonai migrate-data` | ||
| - [ ] Update workflow process to Workflow class | ||
| - [ ] Replace BotApprovalBackend with platform-specific approvals | ||
| - [ ] Update embedding imports | ||
| - [ ] Run tests to ensure functionality | ||
|
|
||
| ### Testing Your Migration | ||
|
|
||
| After migrating: | ||
|
|
||
| ```bash | ||
| # Run with deprecation warnings as errors to catch any missed items | ||
| python -W error::DeprecationWarning your_script.py | ||
|
|
||
| # Or use pytest | ||
| python -m pytest -W error::DeprecationWarning | ||
| ``` | ||
|
|
||
| ## Getting Help | ||
|
|
||
| - **Documentation:** Check the updated docs for new patterns | ||
| - **Examples:** See `/examples` for updated usage patterns | ||
| - **Community:** Ask questions in GitHub Discussions | ||
| - **Issues:** Report migration problems in GitHub Issues | ||
|
|
||
| ## Contributing | ||
|
|
||
| When adding new deprecations: | ||
|
|
||
| 1. Use the `@deprecated` decorator from `praisonaiagents.utils.deprecation` | ||
| 2. Specify `since` and `removal` versions | ||
| 3. Provide clear `alternative` guidance | ||
| 4. Update this MIGRATION.md file | ||
| 5. Add deprecation to the test suite | ||
|
|
||
| Example: | ||
| ```python | ||
| from praisonaiagents.utils.deprecation import deprecated | ||
|
|
||
| @deprecated( | ||
| since="1.5.0", | ||
| removal="2.0.0", | ||
| alternative="use new_function() instead", | ||
| details="The new function provides better error handling" | ||
| ) | ||
| def old_function(): | ||
| pass | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Syntax error in "Old Way" code example.
Line 125 contains invalid Python syntax:
result = process='workflow'. This appears to be a typo or incomplete example that would confuse users trying to understand the deprecated pattern.📝 Suggested fix
Please correct this example to show the actual deprecated usage pattern. Based on the context, it might be something like:
Or if this was meant to show a different pattern, please clarify the actual deprecated API.
🤖 Prompt for AI Agents