diff --git a/scripts/multi_agent.py b/scripts/multi_agent.py index af5e6a1..adfc07e 100644 --- a/scripts/multi_agent.py +++ b/scripts/multi_agent.py @@ -50,6 +50,9 @@ def main(): help="Resume a SUSPENDED run: skip config_builder, poll " "this experiment_id, then run the analyzer. The " "goal is still required (the analyzer needs it).") + parser.add_argument("--output", metavar="FILE.md", + help="Write the final analysis/answer to this markdown file " + "(in addition to printing it).") parser.add_argument("--poll-budget-seconds", type=float, default=180.0, help="How long the poll stage waits before suspending.") args = parser.parse_args() @@ -75,6 +78,15 @@ def main(): for stage, sub_id in result.sub_run_ids.items(): console.print(f"[dim] {stage}: {sub_id}[/dim]") + if args.output and result.analysis: + with open(args.output, "w", encoding="utf-8") as f: + f.write(result.analysis + "\n\n---\n" + f"*Generated by {args.model} | orchestrator run " + f"{result.orchestrator_run_id} | outcome: {result.outcome}. " + "Agent-drafted from sealed capsules — verify numbers with " + "scripts/tools/grade_analyses.py before publication.*\n") + console.print(f"[dim]Analysis written to {args.output}[/dim]") + if result.outcome in ("complete", "answered", "needs_experiment") and result.analysis: console.print(Panel(Markdown(result.analysis), title="📊 Analysis", border_style="green"))