V0.13.1
✨ New Features
-
Per‑Step Token Budget
Introducedagent_step_token_budgetinFunctionConfig. When set, the built‑in step loop stops as soon as the accumulated prompt tokens for the current Step reach the configured budget. This gives fine‑grained control over token usage per iteration, preventing runaway costs in long-running agent loops.
Default:None(unlimited). -
Between‑Step History Compression
Addedmemory_abstract_thresholdinLLMConfig. When the real API prompt‑token count exceeds this threshold at a Step boundary, the oldest history is automatically folded into a single summary message. The summary is generated by the LLM, preserving tool‑call/result pairs to keep the context well‑formed. If the summary fails or is empty, the history remains untouched and the token baseline is reset (no retry loop).
Default:None(never compress).
🔧 Improvements
- The token budget is now injected into the run state from the configuration, allowing the step loop to query
TokenBudget.exhausteddirectly. - The
TokenBudgetclass gained areset()method to clear accumulated counts while preserving the configured budget, used after compression. - The
anthropicdependency version constraint has been relaxed to<0.121.0to accommodate recent releases.
📚 Documentation
- All architecture diagrams in the guide have been migrated from ASCII art to Mermaid diagrams for better readability.
- The step‑loop documentation now includes a full explanation of between‑step compression and token budget control.
- Configuration tables in the Concepts section have been updated to reflect the new settings and their defaults.
- API references for
FunctionConfigandLLMConfignow document both new parameters.
🧪 Testing
- Extensive new test coverage for token budget exhaustion, budget injection, and all compression scenarios (threshold conditions, empty summaries, tool‑pair preservation, and baseline reset).
⬆️ Dependencies
- Upgraded
mermaidfrom11.15.0to11.16.1in the documentation build.
PRs
- Build(deps-dev): Bump anthropic from 0.118.0 to 0.120.2 by @dependabot[bot] in #143
- Build(deps-dev): Bump mermaid from 11.15.0 to 11.16.1 in /docs by @dependabot[bot] in #145
- Build(deps): Bump js-yaml from 3.15.0 to 3.15.1 in /docs by @dependabot[bot] in #146
- feat: add per-step token budget and between-step history compression by @JohnRichard4096 in #147
Full Changelog: 0.13.0...0.13.1