Skip to content

feat(core): add execution step budgets - #892

Open
Whxuan0701 wants to merge 1 commit into
apache:mainfrom
Whxuan0701:agent/execution-step-budget
Open

Whxuan0701 wants to merge 1 commit into
apache:mainfrom
Whxuan0701:agent/execution-step-budget

Conversation

@Whxuan0701

Copy link
Copy Markdown

Add an explicit per-call execution budget so applications with intentional agent loops can fail safely instead of running without a bound.

Changes

  • add max_steps to run, arun, iterate, and aiterate
  • raise a public ApplicationExecutionLimitError only when another action remains after the allowed steps
  • expose the limit, last action, and current state on the exception for persistence or escalation
  • keep natural graph completion and halt conditions higher priority than the budget error
  • validate positive integer budgets and document inspection and resume behavior

How I tested this

  • pre-commit run --all-files
  • python -m pytest tests --ignore=tests/integrations/persisters --ignore=tests/integrations/test_bip0042_bedrock.py -q (655 passed, 1 skipped)
  • python -m sphinx -T -W --keep-going -b dirhtml -d <doctrees> -D language=en . <html> from docs/

Notes

The budget is local to one execution call and does not depend on the application's global sequence ID. A caller can inspect the exception state and resume with a later call.

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@github-actions github-actions Bot added area/core Application, State, Graph, Actions area/website burr.apache.org website labels Aug 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Application, State, Graph, Actions area/website burr.apache.org website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant