Skip to content

AgentLoopDetection reward

Bases: _RubricPreset

LM judges repeated calls or cycles; use to debug looping agents.

Example:

program.compile(
    reward=synalinks.rewards.AgentLoopDetection(
        language_model=language_model,
    ),
    optimizer=synalinks.optimizers.RandomFewShot(),
)
Source code in synalinks/src/rewards/rubric_rewards.py
@synalinks_export(
    [
        "synalinks.AgentLoopDetection",
        "synalinks.rewards.AgentLoopDetection",
    ]
)
class AgentLoopDetection(_RubricPreset):
    """LM judges repeated calls or cycles; use to debug looping agents.

    Example:

    ```python
    program.compile(
        reward=synalinks.rewards.AgentLoopDetection(
            language_model=language_model,
        ),
        optimizer=synalinks.optimizers.RandomFewShot(),
    )
    ```
    """

    preset = "agent_loop_detection"