Skip to content

catch exceptions and retries in http transport layer#363

Open
zeedann wants to merge 1 commit intomainfrom
backend/catch-exceptions
Open

catch exceptions and retries in http transport layer#363
zeedann wants to merge 1 commit intomainfrom
backend/catch-exceptions

Conversation

@zeedann
Copy link
Collaborator

@zeedann zeedann commented Mar 7, 2026

This pull request improves the robustness and user experience of web search and LLM streaming features by enhancing error handling, providing clearer metadata in responses, and updating related formatting and tests. The most important changes are grouped below:

Web Search Tool Enhancements:

  • Added provider metadata (provider, max_results_requested, max_results_used) to the web_search tool output and improved the parameter description for clarity. Introduced clamping of max_results to a safe range (1–10), with a normalization helper function. [1] [2] [3]
  • Improved error handling in the web_search tool to return structured error responses with descriptive error_type fields for timeouts, HTTP errors, and unexpected exceptions.

Error Handling Improvements Across Streaming and LLM Calls:

  • Updated exception handling in agent loop, server, and transport layers to treat httpx.RemoteProtocolError as a transient error (along with timeouts and connection errors), enabling retries and more user-friendly error messages when connections are interrupted. [1] [2] [3] [4] [5] [6]
  • Enhanced error messages shown to users when streaming connections are interrupted, providing actionable feedback instead of raw exception text. [1] [2] [3] [4]

Formatting and Test Updates:

  • Updated CLI formatting functions to display max_results in web search summaries and include the provider in result hints for better transparency. [1] [2]
  • Added tests for the web search tool to verify provider metadata, result clamping, and improved error reporting. Also added a test to ensure LLM calls are retried on protocol errors. [1] [2]

@zeedann zeedann requested a review from bicced March 7, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant