#!/usr/bin/env python3 """ CLI: run the full CitationEdge pipeline on a PDF. Usage: python scripts/run_agent.py path/to/paper.pdf python scripts/run_agent.py path/to/paper.pdf --job-id my_job_123 """ import argparse import asyncio import json import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent)) from dotenv import load_dotenv load_dotenv() from orchestrators.custom_orchestrator import CitationEdgeOrchestrator from utils.helpers import generate_id from utils.logger import get_logger logger = get_logger("run_agent") async def main(): parser = argparse.ArgumentParser(description="Run CitationEdge analysis on a PDF") parser.add_argument("pdf_path", help="Path to the research paper PDF") parser.add_argument("--job-id", default=None, help="Custom job ID (auto-generated if omitted)") args = parser.parse_args() pdf_path = Path(args.pdf_path) if not pdf_path.exists(): print(f"Error: PDF not found: {pdf_path}") sys.exit(1) job_id = args.job_id or generate_id("cli") print(f"\n=== Agentic CitationEdge ===") print(f"Job ID: {job_id}") print(f"PDF: {pdf_path}") print(f"Starting 7-agent pipeline...\n") orch = CitationEdgeOrchestrator() result = await orch.run(job_id=job_id, pdf_path=str(pdf_path)) print("\n=== Pipeline Complete ===") print(json.dumps(result, indent=2, default=str)) scores = result.get("scores", {}) if scores: print(f"\n Overall Score: {scores.get('overall_score', 0):.1f}/10") print(f" Literary: {scores.get('literary_score', 0):.1f}/10") print(f" Argument: {scores.get('argument_score', 0):.1f}/10") print(f" Citations: {scores.get('citation_completeness', 0):.1f}/10") print(f"\n Report: {result.get('report_path', 'N/A')}") if __name__ == "__main__": asyncio.run(main())