Skip to content

docs: supersede #330 — PR #1635 reverted by #1642, drop Agent(max_budget=...) & clean CLI BudgetExceededError docs; verify budget.mdx #334

@MervinPraison

Description

@MervinPraison

Source change

PraisonAI PR #1642 (merged 2026-05-09 21:44 UTC) reverts #1635, which had fixed #1627. The revert was merged ~47 seconds after Docs issue #330 was filed, so #330 (which asked to document the now-removed features) is stale and must not be implemented as written.

This new issue replaces #330. It documents the post-revert state and the (much smaller) doc work that's actually needed.


What the revert removed

PR #1642 (29 additions / 101 deletions across 2 files) removed the following from main of MervinPraison/PraisonAI:

1. Top-level Agent(max_budget=...) parameter — GONE

src/praisonai-agents/praisonaiagents/agent/agent.py no longer has max_budget in Agent.__init__. Any code written against PR #1635 will now raise:

TypeError: Agent.__init__() got an unexpected keyword argument 'max_budget'

The synced copy here (praisonaiagents/agent/agent.py) was already pre-#1635 and stays that way — verified at lines 540-558:

output: Optional[Union[bool, str, Dict[str, Any], 'OutputConfig']] = None,
execution: Optional[Union[bool, str, Dict[str, Any], 'ExecutionConfig']] = None,
templates: Optional[Union[Dict[str, Any], 'TemplateConfig']] = None,
# ...no max_budget parameter...

2. CLI graceful BudgetExceededError handler — GONE

src/praisonai/praisonai/cli/main.py no longer has _execute_agent_with_budget_handling(). All agent.start(...) / agent.chat(...) calls across CLI display modes (silent, quiet, verbose, debug, jsonl, json, editor, default) are back to direct calls. Budget errors will once again surface as full Python tracebacks in the praisonai CLI.

3. What is still in the SDK (unchanged)

Item Location Status
ExecutionConfig.max_budget praisonaiagents/config/feature_configs.py:741 ✅ Still works — the canonical API
ExecutionConfig.on_budget_exceeded praisonaiagents/config/feature_configs.py:743-744 ✅ Still works
BudgetExceededError class praisonaiagents/errors.py:114 ✅ Exported from top-level package (from praisonaiagents import BudgetExceededError)
Agent runtime budget enforcement praisonaiagents/agent/agent.py:970, 1662-1663 (_max_budget) ✅ Still works

Result: budget functionality itself is intact — only the convenience shortcut and CLI UX polish were removed.


Doc audit — what already exists

File Lines Mentions max_budget? Action needed
docs/concepts/budget.mdx 287 Yes — exclusively via Agent(execution=ExecutionConfig(max_budget=...)). Never shows Agent(max_budget=...) direct usage. None — already correct after the revert. Verify only.
docs/concepts/execution.mdx 314 No No change needed for the revert
docs/configuration/execution-config.mdx 201 No No change needed for the revert
docs/configuration/agent-config.mdx No No change needed for the revert
docs/cli/cli-reference.mdx No No change needed for the revert
$ grep -rn "max_budget" docs/ features/
docs/concepts/budget.mdx:41:    execution=ExecutionConfig(max_budget=0.50)  # Stop at $0.50
docs/concepts/budget.mdx:130:        max_budget=0.50,
docs/concepts/budget.mdx:150:        max_budget=1.00,
docs/concepts/budget.mdx:169:        max_budget=2.00,
docs/concepts/budget.mdx:212:    max_budget=0.50,              # USD limit (None = no limit)

All occurrences are inside ExecutionConfig(...) — i.e. the docs already match the post-revert SDK.


Required documentation work

Task A — Close / supersede issue #330 (administrative)

Important

Issue #330 was filed against PR #1635, which has now been reverted. Any agent that picks up #330 will produce code that fails with TypeError. This issue (the one you are reading) supersedes #330.

Task B — Verification pass on docs/concepts/budget.mdx (HUMAN-APPROVED)

Per AGENTS.md §1.8, docs/concepts/ is HUMAN-ONLY. AI agents must not edit this file. The verification below is for a human reviewer.

The page is already correct (uses Agent(execution=ExecutionConfig(max_budget=...)) everywhere). Optional polish a human may apply:

  1. Add a small "Common mistakes" callout in docs/concepts/budget.mdx near the Quick Start, since users frequently try the (non-existent) shortcut first — this was the root cause of #1627:

    <Warning>
      `max_budget` is **not** a direct `Agent()` parameter. It must live inside
      `ExecutionConfig`:
    
      ```python
      # ❌ Wrong — raises TypeError
      Agent(name="R", instructions="...", max_budget=0.50)
    
      # ✅ Correct
      Agent(name="R", instructions="...",
            execution=ExecutionConfig(max_budget=0.50))
    ```
  2. Add a CLI-behaviour note clarifying that, when running through the praisonai CLI, a BudgetExceededError currently surfaces as a Python traceback — users who want a clean message must catch it in their own code (example already present at lines 124-139).

Task C — docs/features/ (AI agent may proceed if directed)

No new feature page is needed. Do not create docs/features/agent-max-budget.mdx (this was Task 1 of #330) — the underlying parameter no longer exists.

If an AI agent has already created such a page on a feature branch following #330, it must be deleted before that branch is merged.

Task D — Other pages

Tasks 2a / 2b / 2c from #330 (adding max_budget/on_budget_exceeded rows to execution-config.mdx, agent-config.mdx, cli-reference.mdx) were optional improvements not directly tied to PR #1635. They could still be useful as standalone "complete the ExecutionConfig reference" work — but if any of those edits explicitly mention the now-removed top-level Agent(max_budget=...) shortcut or the now-removed clean CLI handler, they must be reworded to use ExecutionConfig only and to acknowledge that CLI budget errors currently surface as tracebacks.

Track those reference-completeness improvements in a separate issue, not here.


Acceptance criteria


References

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeTrigger Claude Code analysisdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions