Skip to content

fix(report_agent): handle API token overflow crash with context lengt…#129

Open
ai-x-builder wants to merge 1 commit into666ghj:mainfrom
ai-x-builder:fix/fix-priority-issues-mNNjT
Open

fix(report_agent): handle API token overflow crash with context lengt…#129
ai-x-builder wants to merge 1 commit into666ghj:mainfrom
ai-x-builder:fix/fix-priority-issues-mNNjT

Conversation

@ai-x-builder
Copy link

Add error handling in LLMClient for context_length_exceeded errors with
automatic message trimming and retry (fixes #52)
Add configurable LLM_MAX_TOKENS env variable (default 4096) so users
with different models can set appropriate limits
Add message history pruning in report agent ReACT loop to prevent
unbounded context growth that causes token overflow
Import and handle openai.BadRequestError and APIError explicitly

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. LLM API Any questions regarding the LLM API labels Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM API Any questions regarding the LLM API size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API最大长度超过导致程序奔溃

1 participant