docs: update AsyncAgentScheduler, managed-agents-local, and tool-resolver for PR #1784#466
Conversation
…lver for PR #1784 - Add timeout and max_cost constructor parameters to AsyncAgentScheduler - Add factory methods: from_yaml(), start_from_yaml_config(), from_recipe() - Update get_stats() behavior - now async method delegating to get_stats_async() - Add cost tracking fields: total_cost_usd, remaining_budget - Add Budget & Timeout Behaviour section with mermaid diagram - Update both async-agent-scheduler.mdx and async-scheduler.mdx - Add reset_default_resolver() documentation to tool-resolver.mdx - Flag managed-agents-local.mdx changes for human approval (see PR description) Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
|
Warning Review limit reached
More reviews will be available in 53 minutes. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughDocumentation updates to AsyncAgentScheduler reflecting SDK feature additions: new ChangesAsyncAgentScheduler and ToolResolver Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Review Summary by QodoDocument AsyncAgentScheduler enhancements and tool-resolver updates
WalkthroughsDescription• Add timeout and max_cost constructor parameters to AsyncAgentScheduler • Document factory methods: from_yaml(), start_from_yaml_config(), from_recipe() • Update get_stats() to async method with breaking change warning • Add cost tracking fields: total_cost_usd and remaining_budget • Add Budget & Timeout Behaviour section with mermaid diagram • Document reset_default_resolver() for tool-resolver multi-tenant usage Diagramflowchart LR
A["AsyncAgentScheduler<br/>Constructor"] -->|"Add timeout<br/>& max_cost"| B["Enhanced<br/>Parameters"]
A -->|"Add factory<br/>methods"| C["from_yaml()<br/>from_recipe()"]
D["get_stats()<br/>Method"] -->|"Breaking change:<br/>now async"| E["Atomic snapshot<br/>with lock"]
E -->|"Add cost<br/>fields"| F["total_cost_usd<br/>remaining_budget"]
G["Budget &<br/>Timeout"] -->|"Visualize<br/>flow"| H["Mermaid<br/>Diagram"]
I["tool-resolver"] -->|"Add reset<br/>function"| J["reset_default_resolver()<br/>Multi-tenant support"]
File Changes1. docs/features/async-agent-scheduler.mdx
|
Code Review by Qodo
1.
|
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for AsyncAgentScheduler and ToolResolver to cover new features such as budget tracking, timeouts, factory methods, and cache resetting. However, the review feedback highlights several critical discrepancies where the documented features and methods are either completely unimplemented, commented out, or broken in the underlying codebase. Additionally, some documented behaviors (like get_stats() delegation) do not match the actual implementation, and a code example is missing a necessary import.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| scheduler = AsyncAgentScheduler( | ||
| agent, | ||
| task="Check the latest AI news", | ||
| timeout=60, # cancel any run that exceeds 60s | ||
| max_cost=2.00, # stop the scheduler after $2.00 total spend | ||
| ) | ||
| await scheduler.start("hourly", max_retries=3, run_immediately=True) | ||
|
|
||
| # ... run your app ... | ||
|
|
||
| await scheduler.stop() | ||
| stats = await scheduler.get_stats() | ||
| print(f"Total cost: ${stats['total_cost_usd']}") | ||
| print(f"Remaining budget: ${stats['remaining_budget']}") |
There was a problem hiding this comment.
The timeout and max_cost parameters, as well as the total_cost_usd and remaining_budget keys in the stats dictionary, are currently commented out / not implemented in the canonical AsyncAgentScheduler class (see praisonai/scheduler/async_agent_scheduler.py). Running this example will result in a TypeError (unexpected keyword argument) or KeyError (missing dictionary keys). Please ensure these features are implemented in the codebase before documenting them, or remove/comment them out in the documentation until they are supported.
| ## Factory Methods | ||
|
|
||
| Create a scheduler directly from YAML or a recipe instead of wiring an agent manually. | ||
|
|
||
| ### `AsyncAgentScheduler.from_yaml(...)` | ||
|
|
||
| ```python | ||
| from praisonai.scheduler.async_agent_scheduler import AsyncAgentScheduler | ||
|
|
||
| scheduler = AsyncAgentScheduler.from_yaml("agents.yaml") | ||
| await scheduler.start_from_yaml_config() # uses interval/max_retries/run_immediately from YAML | ||
| ``` |
There was a problem hiding this comment.
The factory method from_yaml and the instance method start_from_yaml_config are currently not implemented in AsyncAgentScheduler (they are commented out or completely missing in praisonai/scheduler/async_agent_scheduler.py). Documenting them will lead to AttributeError for users attempting to use these features. Please ensure these methods are implemented in the codebase before documenting them.
| ### `AsyncAgentScheduler.from_recipe(...)` | ||
|
|
||
| ```python | ||
| scheduler = AsyncAgentScheduler.from_recipe("news-monitor") | ||
| await scheduler.start_from_yaml_config() | ||
| ``` |
There was a problem hiding this comment.
The factory method from_recipe is currently not implemented in AsyncAgentScheduler (it is commented out in praisonai/scheduler/async_agent_scheduler.py). Documenting it will lead to AttributeError for users attempting to use this feature. Please ensure this method is implemented in the codebase before documenting it.
| ## Factory Methods | ||
|
|
||
| Create a scheduler directly from YAML or a recipe instead of wiring an agent manually. | ||
|
|
||
| ### `AsyncAgentScheduler.from_yaml(...)` | ||
|
|
||
| ```python | ||
| from praisonai.scheduler.async_agent_scheduler import AsyncAgentScheduler | ||
|
|
||
| scheduler = AsyncAgentScheduler.from_yaml("agents.yaml") | ||
| await scheduler.start_from_yaml_config() # uses interval/max_retries/run_immediately from YAML | ||
| ``` | ||
|
|
||
| ### `AsyncAgentScheduler.from_recipe(...)` | ||
|
|
||
| ```python | ||
| scheduler = AsyncAgentScheduler.from_recipe("news-monitor") | ||
| await scheduler.start_from_yaml_config() | ||
| ``` | ||
|
|
||
| See [Async Agent Scheduler](/docs/features/async-agent-scheduler#factory-methods) for complete parameter documentation. |
There was a problem hiding this comment.
The factory methods from_yaml and from_recipe, as well as the instance method start_from_yaml_config, are currently not implemented in AsyncAgentScheduler (they are commented out or completely missing in praisonai/scheduler/async_agent_scheduler.py). Documenting them will lead to AttributeError for users attempting to use these features. Please ensure these methods are implemented in the codebase before documenting them.
| from praisonai.tool_resolver import reset_default_resolver | ||
|
|
||
| # Switching tenants / projects | ||
| os.chdir("/path/to/tenant_b") | ||
| reset_default_resolver() # next ToolResolver() reload picks up the new CWD |
There was a problem hiding this comment.
In the code example, os is used but not imported. Please import os to make the example complete and runnable.\n\nAdditionally, please note that reset_default_resolver() is currently broken in praisonai/tool_resolver.py because:\n1. It is defined twice (lines 545 and 624). The second definition overwrites the first.\n2. The second definition references _default_resolver and _default_resolver_lock, neither of which are defined in praisonai/tool_resolver.py. Calling this function will raise a NameError.\n\nPlease fix the implementation in praisonai/tool_resolver.py so that the documented feature actually works.
import os\nfrom praisonai.tool_resolver import reset_default_resolver\n\n# Switching tenants / projects\nos.chdir(\"/path/to/tenant_b\")\nreset_default_resolver() # next ToolResolver() reload picks up the new CWD
| | `get_stats()` | sync | **Best-effort, NOT atomic** — counters may be observed mid-update | Quick sync checks, tests, scripts | | ||
| | `get_stats_sync()` | sync | Alias for `get_stats()` (same best-effort behaviour, named for clarity) | When you want the sync intent obvious in code | | ||
| | `get_stats_async()` | async | **Atomic snapshot** under `_stats_lock` | Inside async code paths where consistency matters | | ||
| | `await scheduler.get_stats()` | async | **Atomic snapshot** under `_stats_lock`. As of PR #1784, this method now delegates to `get_stats_async()`. | Anywhere — this is the canonical reader. | |
There was a problem hiding this comment.
The documentation states that get_stats() delegates to get_stats_async(). However, in praisonai/scheduler/async_agent_scheduler.py, get_stats() has its own independent implementation and does not acquire _stats_lock or delegate to get_stats_async(). Please update either the implementation or the documentation to ensure consistency.
There was a problem hiding this comment.
Pull request overview
Documentation-only PR updating three feature pages to reflect SDK changes from upstream PR #1784: new timeout/max_cost constructor params and factory methods on AsyncAgentScheduler, the breaking change making get_stats() async, and the addition of reset_default_resolver() to the tool resolver.
Changes:
- Document new
timeout/max_costparameters,from_yaml/start_from_yaml_config/from_recipefactory methods, and newtotal_cost_usd/remaining_budgetstats fields onAsyncAgentScheduler, including a Budget & Timeout mermaid diagram. - Update Reading Stats sections to reflect that
get_stats()is now async (delegates toget_stats_async()) and add a behaviour-change warning. - Document
reset_default_resolver()for clearing the process-wide tool resolver cache (multi-tenant / CWD-change use cases).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/features/async-agent-scheduler.mdx | Adds timeout/max_cost params, factory methods, new cost stats fields, budget/timeout flow diagram, and rewrites Reading Stats. |
| docs/features/async-scheduler.mdx | Mirrors updates on the duplicate page; adds duplicate-page notice pointing to the canonical reference. |
| docs/features/tool-resolver.mdx | Adds a "Resetting the Default Resolver" subsection for reset_default_resolver(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | `await scheduler.get_stats()` | async | **Atomic snapshot** under `_stats_lock`. As of PR #1784, this method now delegates to `get_stats_async()`. | Anywhere — this is the canonical reader. | | ||
| | `await scheduler.get_stats_async()` | async | **Atomic snapshot** under `_stats_lock`. | Equivalent to `get_stats()`; kept for explicit-naming readability. | | ||
| | `scheduler.get_stats_sync()` | sync | **Best-effort, no lock** — counters may be observed mid-update. | Sync contexts only (tests, scripts, REPL). Avoid in async code. | |
| class H tear | ||
| ``` | ||
|
|
||
| Statistics can be read in two equivalent ways from async code, and in one sync-safe way: |
|
@copilot Do a thorough review of this PR. Read ALL existing reviewer comments above first. Review areas:
|
|
@claude You are the FINAL architecture reviewer. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding. Phase 1: Review per AGENTS.md
Phase 2: FIX Valid Issues Phase 3: Final Verdict |
|
Claude finished @MervinPraison's task —— View job Architecture Review COMPLETE ✅Phase 1: Review per AGENTS.md
Phase 2: Fix Valid Issues
Phase 3: Final Verdict
✅ RESOLUTION: ALL REVIEWER ISSUES FIXEDCritical Finding: All reviewers (Gemini, Qodo, CodeRabbit, Copilot) correctly identified that the documentation described features not implemented in the SDK, violating AGENTS.md §1.3: "Documentation MUST reflect SDK ground truth." ✅ Comprehensive Fixes Applied:
Files Modified:
Verification:
RECOMMENDATION: APPROVE AND MERGE The PR now correctly documents only implemented features and provides accurate API information. All critical reviewer feedback has been addressed. |
Reviewed all prior comments and completed a full pass. Findings:
Also ran parallel validation: Code Review ✅, CodeQL ✅ (trivial docs-only changes). |
Remove undocumented features that don't exist in current SDK: - timeout/max_cost parameters (commented as TODO) - Factory methods from_yaml/from_recipe (not implemented) - Cost tracking fields in stats (commented as TODO) - Incorrect get_stats() atomicity claims Fix broken reset_default_resolver() by removing duplicate definition and add missing import os to documentation example. Addresses all issues raised by code reviewers to ensure docs match SDK truth. Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/features/async-scheduler.mdx (1)
161-216:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftFix async-scheduler.mdx to avoid documenting unimplemented/incorrect AsyncAgentScheduler APIs
docs/features/async-scheduler.mdxdocumentsconfig={"timeout": 120}(and timeout/budget behavior), butpraisonai/scheduler/async_agent_scheduler.pyhastimeout/max_costsupport left as TODO/commented out.docs/features/async-scheduler.mdxlistsscheduler.get_stats()as sync (Reading Stats table), but the implementation definesasync def get_stats(...)—onlyget_stats_sync()is the sync API.- Since this is a duplicate page, collapse it to a pointer to the canonical doc or mirror only the currently shipped APIs/behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/features/async-scheduler.mdx` around lines 161 - 216, Update docs/features/async-scheduler.mdx to reflect the shipped AsyncAgentScheduler API: remove or mark as TODO the documented timeout and max_cost behavior (references: timeout, max_cost in AsyncAgentScheduler), correct the Reading Stats table to show get_stats() is async (await scheduler.get_stats()) and list get_stats_sync() as the sync alternative (references: get_stats, get_stats_async, get_stats_sync), and collapse this duplicate page into a short pointer to the canonical Async Agent Scheduler doc (or mirror only currently implemented behaviors) so the docs no longer claim unimplemented features.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/features/async-scheduler.mdx`:
- Around line 10-12: The page currently begins with the duplicate-page Note
before the required hero Mermaid diagram; move the Note block so it appears
after the hero diagram (the Mermaid block that visually introduces
AsyncAgentScheduler) so the file starts with the hero Mermaid diagram, then
include the duplicate-page notice referencing AsyncAgentScheduler/Async Agent
Scheduler below it; ensure the hero diagram remains the first content element
and the canonical reference text and link are preserved exactly.
In `@docs/features/tool-resolver.mdx`:
- Around line 247-249: The intro under the heading should be condensed into a
single sentence: replace the two-sentence block with one concise sentence that
mentions calling reset_default_resolver() to clear the process-wide resolver
cache and when to use it (e.g., between tenants, on CWD change, or in test
setup) so local tools.py resolution is not affected by prior calls; ensure this
single sentence sits directly under the heading and remove the extra
sentence/line break.
- Around line 251-257: The example uses os.chdir but omits the os import; add
"import os" at the top of the snippet so it runs as-is, keeping the existing
import from praisonai.tool_resolver (reset_default_resolver) and the comment
about ToolResolver() behavior; ensure the final snippet starts with import os
followed by from praisonai.tool_resolver import reset_default_resolver.
---
Outside diff comments:
In `@docs/features/async-scheduler.mdx`:
- Around line 161-216: Update docs/features/async-scheduler.mdx to reflect the
shipped AsyncAgentScheduler API: remove or mark as TODO the documented timeout
and max_cost behavior (references: timeout, max_cost in AsyncAgentScheduler),
correct the Reading Stats table to show get_stats() is async (await
scheduler.get_stats()) and list get_stats_sync() as the sync alternative
(references: get_stats, get_stats_async, get_stats_sync), and collapse this
duplicate page into a short pointer to the canonical Async Agent Scheduler doc
(or mirror only currently implemented behaviors) so the docs no longer claim
unimplemented features.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e80a34b8-04eb-4454-99db-a4fb1a0281f2
📒 Files selected for processing (3)
docs/features/async-agent-scheduler.mdxdocs/features/async-scheduler.mdxdocs/features/tool-resolver.mdx
| Call `reset_default_resolver()` to clear the process-wide resolver cache. | ||
| Useful between tenants, on CWD change, or in test setup so that local | ||
| `tools.py` resolution is not affected by previous calls. |
There was a problem hiding this comment.
Keep the section intro to exactly one sentence.
This intro is currently split into multiple sentences; compress it to one sentence directly under the heading.
As per coding guidelines, "Section introductions in documentation must be exactly one sentence, not multiple sentences".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/features/tool-resolver.mdx` around lines 247 - 249, The intro under the
heading should be condensed into a single sentence: replace the two-sentence
block with one concise sentence that mentions calling reset_default_resolver()
to clear the process-wide resolver cache and when to use it (e.g., between
tenants, on CWD change, or in test setup) so local tools.py resolution is not
affected by prior calls; ensure this single sentence sits directly under the
heading and remove the extra sentence/line break.
Updates documentation to reflect changes from MervinPraison/PraisonAI#1784 which added complete AsyncAgentScheduler parity, fail-loud pip installs, and removed broken resolver.
Changes Made
✅ Updated docs/features/async-agent-scheduler.mdx
✅ Updated docs/features/async-scheduler.mdx
✅ Updated docs/features/tool-resolver.mdx
🚨 Human Approval Required: docs/concepts/managed-agents-local.mdx
Per AGENTS.md §1.8, the docs/concepts/ folder requires human approval. Need to add fail-loud pip install behavior documentation.
Proposed changes: Add warning and bootstrap failure modes table showing the new RuntimeError exceptions for pip install failures in both host and compute scenarios.
@MervinPraison please review and approve changes for managed-agents-local.mdx
Fixes #461
🤖 Generated with Claude Code
Summary by CodeRabbit