gallery icon indicating copy to clipboard operation
gallery copied to clipboard

Added exponential backoff capabilities

Open pcodding opened this issue 3 months ago • 0 comments

We're seeing a number of connection issues with the Serper API that resolve themselves when retrying. Instead of requiring the agent to do this and handling it in the Runbook, we should handle it in the action.

Here's the filled-out PR template for the retry logic addition:

Description

This PR adds exponential backoff retry logic to the search_google action to handle intermittent RemoteDisconnected exceptions that occur when the Serper API connection is unexpectedly closed.

Problem: The action was experiencing indeterminate RemoteDisconnected("Remote end closed connection without response") exceptions that would resolve themselves when retrying, causing unreliable search operations.

Solution: Implemented a retry mechanism with exponential backoff (1s, 2s, 4s, 5s max) that automatically retries connection-related failures up to 3 times before failing.

Dependencies: No new dependencies required - uses existing time module and string pattern matching for error detection.

How can (was) this tested?

The retry logic can be tested by:

  • [ ] Connection failure simulation: Temporarily block network access during API calls to trigger connection errors
  • [ ] Normal operation: Verify that successful requests work without retry delays
  • [ ] Error handling: Test with invalid API keys to ensure non-retryable errors fail immediately
  • [ ] Retry behavior: Monitor logs to confirm exponential backoff timing (1s, 2s, 4s delays)

Test configuration:

  • Valid Serper API key required
  • Network connectivity for API calls
  • Monitor action execution logs to observe retry attempts

Screenshots (if needed)

N/A - This is a backend reliability improvement without UI changes.

Checklist:

  • [x] I have bumped the version number for the Action Package / Agent
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation - README.md file
  • [x] I have updated the CHANGELOG.md file in correspondence with my changes
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] OAuth2: I have made sure that action has necessary scopes (works in whitelisted mode)

Note: The retry logic is designed to be transparent to users - no changes to the action's public API or behavior, only improved reliability for connection failures.

pcodding avatar Sep 20 '25 15:09 pcodding