Skip to content

[QUESTION] How can we implement exponentialBackoff in the ADK (reusing or not the retry mechanism in js-genai)? #259

@ipeychev

Description

@ipeychev

Hello,

When we use js-genai directly, outside ADK, we can apply httpOptions to modify the default retry attempts. Since this is often not enough and one cannot modify the default retry codes, in our apps on production we wrap e.g., chatSession.chat.sendMessage with our own exponentialBackoff functionality. It covers other cases, like and error which just prints fetch failed too.

Now, we would like to apply the same, but how can we do this in the ADK? From what we see, ADK abstracts away the direct SDK calls, so we cannot easily wrap individual SDK invocations, can we?

One option was to extend Gemini's *generateContentAsync method, but that seems like too much, doesn't it?

Note:
For the record, it seems Python guys allowed to modify the http retry options, but I'm not sure about implementing a custom exponential backoff logic.

Thanks,
Iliyan

Metadata

Metadata

Labels

enhancementNew feature or requestneeds review[Status] The PR/issue is awaiting review from the maintainerquestionFurther information is requested
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions