Skip to content

Commit e60c52d

Browse files
CasperGNmsfussell
andauthored
docs: document durable agent retry policy (#4982)
* docs: document durable agent retry policy Signed-off-by: Casper Nielsen <[email protected]> * docs: update with DurableRetryConfig class Signed-off-by: Casper Nielsen <[email protected]> * docs: elaborate on fields being optional Signed-off-by: Casper Nielsen <[email protected]> * docs: align with sdk changes Signed-off-by: Casper Nielsen <[email protected]> --------- Signed-off-by: Casper Nielsen <[email protected]> Co-authored-by: Mark Fussell <[email protected]>
1 parent 34201ce commit e60c52d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

daprdocs/content/en/developing-ai/dapr-agents/dapr-agents-patterns.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,34 @@ The Durable Agent enables the concept of "headless agents" - autonomous systems
436436

437437
These options make it easy to process requests asynchronously and integrate seamlessly into larger distributed systems.
438438

439+
### Retry Policy
440+
441+
The Durable Agent supports Dapr Workflow's `RetryPolicy` with the its `WorkflowRetryPolicy`:
442+
443+
- `max_attempts`: max_attempts: Maximum number of retry attempts for workflow operations. Default is 1 (no retries). Set `DAPR_API_MAX_RETRIES` environment variable to override default.
444+
- `initial_backoff_seconds`: Initial backoff duration in seconds. Default is 5 seconds.
445+
- `max_backoff_seconds`: Maximum backoff duration in seconds. Default is 30 seconds.
446+
- `backoff_multiplier`: Backoff multiplier for exponential backoff. Default is 1.5.
447+
- `retry_timeout`: Total timeout for all retries in seconds.
448+
449+
All of the fields are optional. It can be passed to the Durable Agent during instantiation:
450+
451+
```python
452+
from dapr_agents.agents.configs import WorkflowRetryPolicy
453+
travel_planner = DurableAgent(
454+
name="TravelBuddy",
455+
...
456+
retry_policy=WorkflowRetryPolicy(
457+
max_attempts=5,
458+
initial_backoff_seconds=10,
459+
max_backoff_seconds=60,
460+
backoff_multiplier=2.0,
461+
retry_timeout=300,
462+
)
463+
...
464+
)
465+
```
466+
439467

440468
## Choosing the Right Pattern
441469

0 commit comments

Comments
 (0)