Skip to content

docs: add Agent Cost Guardrails to AI & ML tools#5871

Open
sapph1re wants to merge 2 commits into
crewAIInc:mainfrom
sapph1re:add-agent-cost-guardrails-docs
Open

docs: add Agent Cost Guardrails to AI & ML tools#5871
sapph1re wants to merge 2 commits into
crewAIInc:mainfrom
sapph1re:add-agent-cost-guardrails-docs

Conversation

@sapph1re
Copy link
Copy Markdown

@sapph1re sapph1re commented May 20, 2026

Summary

Adds documentation for agent-cost-guardrails, an open-source library that prevents runaway LLM costs in CrewAI crews.

The problem it solves: A typical research crew (Researcher → Writer → Editor) can spend $15–50 in a single crew.kickoff() call with no built-in way to stop it. This library provides:

  • Hard USD budget cap — crew stops when the limit is hit
  • Per-call token cap — individual calls exceeding the limit are rejected before they reach the LLM
  • Alert callbacks at configurable thresholds (e.g. 50%/80% of budget)
  • Cost report broken down by agent and model

Changes

  • New page: docs/en/tools/ai-ml/agentcostguardrails.mdx — full reference with quick start, three examples (basic, alert callbacks, 3-agent crew), parameter table, and cost report schema
  • docs/docs.json — added "en/tools/ai-ml/agentcostguardrails" to the "AI & Machine Learning" navigation group

Package

Summary by CodeRabbit

  • Documentation
    • Added comprehensive documentation for the agent-cost-guardrails library: installation, quick-start, budget alert callbacks, per-call token cap circuit breaker, configuration parameters, cost-report format, and recommended usage patterns.
    • Updated the tools index to include the new agent-cost-guardrails documentation entry.

Review Change Stack

Adds documentation for agent-cost-guardrails, an open-source library
that prevents runaway LLM costs in CrewAI crews via hard budget limits,
per-call token caps, and alert callbacks.

- New page: docs/en/tools/ai-ml/agentcostguardrails.mdx
- Registered in docs/docs.json under "AI & Machine Learning" group
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b612f48-40d8-461c-b105-bb56bcf72c73

📥 Commits

Reviewing files that changed from the base of the PR and between e06d8d6 and ab0fc1c.

📒 Files selected for processing (1)
  • docs/en/tools/ai-ml/agentcostguardrails.mdx
✅ Files skipped from review due to trivial changes (1)
  • docs/en/tools/ai-ml/agentcostguardrails.mdx

📝 Walkthrough

Walkthrough

Adds a new documentation page for the agent-cost-guardrails library and registers it in the docs index. The page includes installation, quick-start usage, examples (budget alerts, per-call token caps), configuration parameters, cost-report schema, and operational tips.

Changes

Agent Cost Guardrails Documentation

Layer / File(s) Summary
Documentation registry entry
docs/docs.json
Adds "en/tools/ai-ml/agentcostguardrails" to the AI/ML tools list in the documentation index.
Documentation page: introduction, quick-start, examples, and reference
docs/en/tools/ai-ml/agentcostguardrails.mdx
New docs page with metadata, installation and quick-start (install/uninstall, cost_report), budget alert callback example, per-call token cap example with a three-agent scenario, configuration parameter descriptions (max_usd, max_tokens_per_call, alert_thresholds, on_alert), cost_report schema, and operational notes about uninstall() and reset().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I hop through docs with a careful pen,
Guarding tokens and budgets for clever AIs again,
Examples and reports, neat and bright,
Alerts and caps to keep costs light,
Read the page and guard your spend with grin.

🚥 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 'docs: add Agent Cost Guardrails to AI & ML tools' directly and clearly summarizes the main changes: adding documentation for the Agent Cost Guardrails library to the AI & ML tools section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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/en/tools/ai-ml/agentcostguardrails.mdx`:
- Line 26: Update the sentence "No API key is required — the library hooks into
the CrewAI runtime locally." to clarify that no additional API key is required
for the guardrails themselves while still requiring standard model/provider
credentials; e.g., replace it with wording like "No additional API key is
required for the guardrails — the library hooks into the CrewAI runtime locally;
you still must provide your usual model/provider credentials (API keys) for any
LLMs or external services." Ensure the changed text appears where the original
sentence is located so readers understand the distinction.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ec207635-e2c3-48ae-8d8f-09751282f835

📥 Commits

Reviewing files that changed from the base of the PR and between 09ffe87 and e06d8d6.

📒 Files selected for processing (2)
  • docs/docs.json
  • docs/en/tools/ai-ml/agentcostguardrails.mdx

Comment thread docs/en/tools/ai-ml/agentcostguardrails.mdx Outdated
@sapph1re
Copy link
Copy Markdown
Author

Hi team! Friendly bump on this PR. The CodeRabbit review passed after the wording update. The library has 100+ PyPI downloads and addresses a real gap — CrewAI crews have no built-in budget cap, and cost blowups are the #1 pain point for teams running agents in production. Happy to adjust anything if there are style/format requirements. Thanks for considering!

@sapph1re
Copy link
Copy Markdown
Author

sapph1re commented Jun 7, 2026

Hi team — bumping this in case it got buried. The PR is review-clean (CodeRabbit approved, no open requests).

Since the last ping, agent-cost-guardrails has picked up measurable adoption — would be great to get it in front of CrewAI users through the docs. Happy to address any feedback or rebase if needed.

Thanks for maintaining CrewAI!

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.

1 participant