"""Pipeline control primitives for agent operation. Thin execution wrappers. The agent decides which stages to run and in what order. """ from __future__ import annotations import logging from typing import Any, Dict, List, Optional logger = logging.getLogger(__name__) def pipeline_run_stage( db_path: str, stage: str, window_id: Optional[str] = None, dry_run: bool = False, ) -> Dict[str, Any]: """Run a single pipeline stage. Args: db_path: Path to DuckDB database stage: Pipeline stage name (e.g. "ingestion", "svd", "similarity") window_id: Optional window identifier (e.g. "2024", "current_parliament") dry_run: If True, return planned actions without executing Returns: dict with status and metadata """ result = { "stage": stage, "window_id": window_id, "dry_run": dry_run, "status": "planned" if dry_run else "not_implemented", } if dry_run: return result # Actual execution would delegate to pipeline/run_pipeline.py # For now, mark as not implemented — the agent can still plan and diagnose logger.info("pipeline_run_stage: %s (dry_run=%s)", stage, dry_run) return result def pipeline_get_logs( db_path: str, stage: Optional[str] = None, lines: int = 50, ) -> List[str]: """Return recent log lines for a stage. Note: This is a placeholder. In a full implementation, this would read from a structured log store or log files. """ # Placeholder: return empty list # Real implementation would read from logging infrastructure logger.info("pipeline_get_logs requested for stage=%s lines=%d", stage, lines) return []