Refactor agent testing and improve error handling #1
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.
This commit introduces several improvements to the agent testing framework and error handling mechanisms.
Key changes include:
stubDispatcherinto more focused test setups, improving test clarity and reusability.ExecuteHandlerandExecuteAsyncHandlerto properly report agent-side issues to the user.ExecuteHandlerto ensure robust handling of5xxresponses from agents.decodePayloadin UI executions to prevent display of partial or incorrect previews.agent.pyto make callbacks more reliable.agent_server.py.AgentAIclass to uselitellm.utils.token_counterfor more accurate token counting and prompt trimming, improving LLM interaction efficiency.execution_stateandasync_execution_managerto use more robust type hinting and internal logic.Refactor agent testing and improve error handling
This commit enhances agent testing by refactoring stub dispatchers and improving error handling for agent communications. Specifically, it adds dedicated tests for agent errors, sentinel values for corrupted JSON previews, and refines IP detection and imports. AI capabilities are improved with better token counting and prompt trimming, and agent setup is streamlined with more resilient fixtures. Overall, this commit boosts test stability and robustness in agent interactions.
Summary
Testing
./scripts/test-all.shChecklist
CHANGELOG.md(or this change does not warrant a changelog entry).Screenshots (if UI-related)
Related issues