diff --git a/rdagent/core/proposal.py b/rdagent/core/proposal.py index 93e20453..cf7e7cbf 100644 --- a/rdagent/core/proposal.py +++ b/rdagent/core/proposal.py @@ -54,6 +54,14 @@ class Trace(Generic[ASpecificScen]): self.scen: ASpecificScen = scen self.hist: list[Tuple[Hypothesis, Experiment, HypothesisFeedback]] = [] + def get_last_experiment_info(self) -> Tuple[Hypothesis, ASpecificTask, Any]: + """Access the last experiment result, sub-task, and the corresponding hypothesis.""" + if not self.hist: + return None + last_hypothesis, last_experiment, _ = self.hist[-1] + last_task = last_experiment.sub_tasks[-1] + last_result = last_experiment.result + return last_hypothesis, last_task, last_result class HypothesisGen: def __init__(self, scen: Scenario):