Add budget control guide for LangChain agents#93
Merged
Conversation
New guide covering per-run budget wrapping of AgentExecutor using the runcycles Python client. Complements the existing per-LLM-call callback handler doc with a pattern for whole-run reservations, tool-level checks, multi-tenant scoping, and graceful degradation via ALLOW_WITH_CAPS. https://claude.ai/code/session_01PzuaGmFdDW83EJxwt6kQua
1 USD = 100,000,000 microcents. The original amounts were off by orders of magnitude (e.g. 5_000_000 labeled as $50 when it's actually $0.05). Corrected all amounts and added inline dollar comments. https://claude.ai/code/session_01PzuaGmFdDW83EJxwt6kQua
- Remove DENY-after-success checks: per protocol spec (line 637), budget denial for dry_run=false comes as 409 BUDGET_EXCEEDED, not decision=DENY on a 200. Matches existing callback handler doc pattern. - Simplify tool-level check to just is_success - Degradation section now shows correct two-way branch (ALLOW vs ALLOW_WITH_CAPS) with error handling for 409 above - Remove unused CyclesMetrics import https://claude.ai/code/session_01PzuaGmFdDW83EJxwt6kQua
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Title: Add budget control guide for LangChain agents
Body:
Summary
AgentExecutorusing Cycles reservations (complementary to existing per-LLM-call callback handler doc)ALLOW_WITH_CAPSdecision=DENYon a 200 (per protocol spec line 637)Test plan
runcyclesclient API (field names, constructor signatures, response access patterns)https://claude.ai/code/session_01PzuaGmFdDW83EJxwt6kQua