How to force activity to retry?

Hi,

I have an activity that makes an api request. Under some cases the api may return some error codes such as a 429 if I am sending too many requests. I want the activity to wait and retry when I get this error code. From the docs I see that I would have to force a timeout to get it to retry. I would prefer to not add a Thread.sleep when I get the error. Is there another way to mark a run as failed?

By default an activity has an associated RetryOptions. So it is retired on any failure which is not marked as non retryable.

So in your case just fail an activity (by throwing an exception in Java/PHP/Typescript or returning error in Go) to get it retried.