#20Accumulate findings across attemptsEasyAgentic AI
Accumulate findings across attempts
Background
On a retry the Orchestrator re-runs only the flagged gap sub-questions, then merges the new results into a running all_findings dict — keeping the answers that were already good and filling the gaps.
for i, sq in enumerate(sub_questions):
all_findings[sq] = results[i]
Problem statement
Implement merge_findings(all_findings, sub_questions, results) updating all_findings in place and returning it.
Input
all_findings— the running dict{sub_question: finding}(mutate in place).sub_questions— the sub-questions just executed.results— their findings, aligned by index.
Output
Returns all_findings after writing each sub_questions[i] → results[i].
Examples
Example 1 — fill a gap
Input: all_findings = {"benchmark": "CodeContests"},
sub_questions = ["impact"], results = ["cited 1000+ times"]
Output: {"benchmark": "CodeContests", "impact": "cited 1000+ times"}
Constraints
- Write each
sub_questions[i] → results[i]intoall_findings. - Existing keys not in
sub_questionsare kept; matching keys are overwritten. - Mutate and return the same dict.
Notes
- Accumulating (rather than discarding) is what makes a retry strictly better — attempt 2 sees everything attempt 1 found, plus the newly-filled gap.
Python
Loading...
▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.
- •Reference example: fill a gap, keep the rest
- •Sample: matching key is overwritten
- •Reference: mutates and returns the same dict