Skip to content

Add retry_on_error feature to repeat block to help developing agents #823

@hirokuni-kitahara

Description

@hirokuni-kitahara

Is your feature request related to a problem? Please describe.
When developers use PDL for AI agent purpose by using ReAct pattern, LLM can make mistakes on function calling and the function code might unexpectedly finishes with an exception. This often happens within a repeat block because it is used as trial loop in ReAct pattern.
If I understand PDL correctly, currently there is no ways to handle such errors, but I believe it would be really useful if this type of features are available.

Describe the solution you'd like
I would like to have a new option of a repeat block retry_on_error, which is a simple boolean attribute indicates whether it should be retried when any errors happen.
By default, this can be set to false and then everything is same as the current implementation. Only when this value is true, the retry feature is enabled.
Also, another attribute like retry_max might be good, which is integer field to specify the maximum number of retrying, to make it customizable.

Additional context
I made a PoC codes in my fork branch and it is ready for making a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions