cursus.pipeline_catalog.core.router

DAG Router — recommends or auto-selects the best DAG for a user’s requirements.

Usage:

from cursus.pipeline_catalog import recommend_dag, auto_select_dag

# Get ranked recommendations: results = recommend_dag(

framework=”pytorch”, features=[“bedrock”, “training”, “edx_uploading”], task_type=”incremental”,

)

# Auto-select best match: dag_id, dag, score = auto_select_dag(framework=”pytorch”, features=[“training”, “calibration”])

recommend_dag(framework=None, features=None, task_type=None, complexity=None, max_results=5)[source]

Recommend DAGs based on requirements. Returns ranked list.

Scoring (0-1):
  • Feature overlap: |required ∩ dag_features| / |required| (weight: 0.5)

  • Framework match: 1.0 if exact match (weight: 0.25)

  • Task type match: 1.0 if substring match (weight: 0.15)

  • Complexity match: 1.0 if exact, 0.5 if adjacent (weight: 0.1)

Parameters:
  • framework (str | None) – Required framework (pytorch, xgboost, lightgbm, etc.)

  • features (List[str] | None) – Required features (e.g., [“training”, “bedrock”, “edx_uploading”])

  • task_type (str | None) – Task type keyword (e.g., “incremental”, “end_to_end”)

  • complexity (str | None) – Desired complexity (simple, standard, advanced, comprehensive)

  • max_results (int) – Maximum number of results to return

Returns:

List of dicts with ‘id’, ‘score’, ‘reasoning’, and all DAG metadata

Return type:

List[Dict[str, Any]]

auto_select_dag(framework=None, features=None, task_type=None, min_score=0.6)[source]

Auto-select the best matching DAG. Returns None if no good match.

Parameters:
  • framework (str | None) – Required framework

  • features (List[str] | None) – Required features

  • task_type (str | None) – Task type keyword

  • min_score (float) – Minimum score threshold (0-1)

Returns:

Tuple of (dag_id, PipelineDAG, score) or None

Return type:

Tuple[str, PipelineDAG, float] | None

recommend_for_agent(data_type=None, has_labels=True, needs_llm=False, multi_task=False, incremental=False, data_volume=None, gpu_available=True, framework=None)[source]

Agent-friendly recommendation using semantic constraints.

Returns ranked DAGs with agent_context (when_to_use, prerequisites, config_guidance). Designed for LLM agents to make pipeline selection decisions.

When framework is given it is a HARD filter: only that framework’s DAGs are considered. The filter is applied before scoring/truncation, so a requested framework can never be crowded out of the top-N by higher-scoring other-framework DAGs.