-
Notifications
You must be signed in to change notification settings - Fork 178
Description
Semantic Retries is a comprehensive approach to handling failures in Golem applications by providing configurable, domain-aware retry policies. The system eliminates the need for ad-hoc retry logic in user code by offering centralized policy management and automatic instrumentation.
The feature consists of two main components:
- Host APIs for Policy Retrieval: A robust interface that allows applications to query retry policies based on the specific action (verb) being performed and the resource (identified by URI) being accessed.
- Runtime Instrumentation: Automatic integration of retry logic into the JavaScript runtime and Golem AI libraries, ensuring that retry policies are applied transparently without requiring developers to implement retry logic manually.
Retry policies are highly configurable and support various strategies including periodic retries, exponential backoff, Fibonacci sequences, and more. Policies can be composed using combinators (and-then, union, intersect) and modified with transformers (time-box, count-box, jitter, clamp). Additionally, policies can be filtered based on predicates that evaluate error properties, allowing for intelligent retry decisions based on the nature of failures.
The system supports wildcards for both verbs and resources, enabling flexible policy definitions that can apply across multiple endpoints or actions. Policies are environment-bound and can optionally be scoped to specific agent types, providing fine-grained control over retry behavior in different contexts.