Conversation
pydantic-ai's own default (UsageLimits(request_limit=50)) is too low for "complex" modules whose agent loop reads several code components and/or spins off sub-module docs via generate_sub_module_documentation_tool. On a real-world run (voll-intelligence, a 5,381-file TypeScript monorepo, 16,720 functions), 4 modules hit UsageLimitExceeded mid-run and were skipped outright — no retry, no fallback to the configured fallback-model, and no CLI flag to raise the limit. All 4 succeeded on the same input once the limit was raised to 100, with no other change.
fabceolin
marked this pull request as draft
September 25, 2026 11:53
The previous commit fixed UsageLimitExceeded on complex modules by raising pydantic-ai's request_limit from 50 (its own default) to 100, but hardcoded the new value with no way to tune it. Some repos/modules need more than 100 requests per agent run, so expose it the same way as the other generation knobs (max_tokens, max_token_per_module, ...): - Config.request_limit (backend), default DEFAULT_REQUEST_LIMIT = 100 - --request-limit on `codewiki generate` and `codewiki config set` - persisted in ~/.codewiki/config.json, shown in `codewiki config show`
This branch has not been deployed
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.
Problem
pydantic-ai's own default (
UsageLimits(request_limit=50)) is too low for "complex" modules whose agent loop reads several code components and/or spins off sub-module docs viagenerate_sub_module_documentation_tool.On a real-world run (
voll-intelligence, a 5,381-file TypeScript monorepo, 16,720 functions), 4 modules hitUsageLimitExceededmid-run and were skipped outright:No retry, no fallback to the configured
fallback-model, and no CLI flag to raise the limit.Fix
UsageLimits(request_limit=100), passed explicitly to bothagent.run(...)call sites inpydantic_ai_backend.py(run_update_agentandrun_module_agent).request_limitnow follows the exact same pattern as the other generation knobs (max_tokens,max_token_per_module, ...):Config.request_limitin the backend (codewiki/src/config.py), defaultDEFAULT_REQUEST_LIMIT = 100--request-limitoncodewiki generateandcodewiki config set~/.codewiki/config.json, shown incodewiki config show(text and--json)Usage
Validation
request_limit=50succeeded on the exact same input once the limit was raised to 100, with no other change.Config.from_cli(...)with and without arequest_limitoverride;PydanticAIBackend._agent_usage_limitspicks up the configured value.Configuration.to_dict/from_dict/to_backend_configround-trip forrequest_limit.codewiki config set --request-limit N+codewiki config showend-to-end (isolatedHOME).codewiki generate --helpshows the new flag; invalid (< 1) values are rejected the same way as the siblingmax_*options.🤖 Generated with Claude Code