Skip to content

Per-Predictor Retry Configuration #3

@bdsaglam

Description

@bdsaglam

Problem

Currently, ActivityConfig applies to all LLM calls within a module uniformly. Different predictors may need different retry/timeout policies.

Example Use Case

class ResearchAgent(dspy.Module):
    def __init__(self):
        # Quick classification - short timeout, few retries
        self.classifier = dspy.Predict("text -> category")
        
        # Complex reasoning - long timeout, more retries
        self.researcher = dspy.ChainOfThought("topic -> detailed_analysis")

The classifier should fail fast, while the researcher needs patience.

Proposed Solution

Allow per-predictor configuration:

temporal_module = TemporalModule(
    agent,
    activity_config=ActivityConfig(timeout=60),  # default
    predictor_config={
        "classifier": ActivityConfig(timeout=10, max_retries=2),
        "researcher": ActivityConfig(timeout=300, max_retries=5),
    }
)

Implementation Notes

  • Need to identify predictors by name or path
  • Consider using module introspection (named_parameters())
  • May require changes to how TemporalLM is created/configured

Priority

Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions