Skip to content

workflows

workflows

ScriptAnalysisError

ScriptAnalysisError(
    message: str | None = None,
    exception: Exception | None = None,
    entity_id: str | None = None,
    entity_name: str | None = None,
    function_name: str | None = None,
    parent_class: str | None = None,
    status: int | None = None,
    domo_instance: str | None = None,
    is_warning: bool = False,
    additional_context: dict[str, Any] | None = None,
)

Bases: DomoError

The script analyzer graph failed while analysing a script.

Raised with the original exception chained as __cause__, so a failure in any graph node reaches the caller instead of being replaced by a different result.

Source code in src/crew_dcs/base/exceptions.py
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def __init__(
    self,
    message: str | None = None,
    exception: Exception | None = None,
    entity_id: str | None = None,
    entity_name: str | None = None,
    function_name: str | None = None,
    parent_class: str | None = None,
    status: int | None = None,
    domo_instance: str | None = None,
    is_warning: bool = False,
    additional_context: dict[str, Any] | None = None,
):
    self.message = message
    self.exception = exception
    self.entity_id = entity_id
    self.entity_name = entity_name
    self.function_name = function_name
    self.parent_class = parent_class
    self.status = status
    self.domo_instance = domo_instance
    self.is_warning = is_warning
    self.additional_context = additional_context or {}

    if not self.message and not self.exception:
        raise ValueError("Either 'message' or 'exception' must be provided.")

    # Use exception chaining if we have an original exception
    if self.exception:
        # This preserves the full traceback chain
        default_msg = self._generate_default_message
        super().__init__(
            f"{default_msg} (caused by: {type(self.exception).__name__}: {self.exception})"
        )
        # Explicitly set the cause for proper exception chaining
        self.__cause__ = self.exception
    else:
        super().__init__(self._generate_default_message)

analyze_python_script

analyze_python_script(script: str) -> dict[str, Any]

Analyze a Python script and return Magic ETL tile recommendations.

Runs the LangGraph pipeline (code analysis, pattern matching, recommendations). There is no fallback: a failure in the graph is raised, not replaced by a different result shape.

Parameters:

Name Type Description Default
script str

Python source text to analyse.

required

Returns:

Type Description
dict[str, Any]

The final graph state, including operations, suggestions, notes and

dict[str, Any]

recommendations.

Raises:

Type Description
ScriptAnalysisError

If the graph raises while analysing the script.

Source code in src/crew_dcs/integrations/agents/script_analyzer/workflows.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def analyze_python_script(script: str) -> dict[str, Any]:
    """Analyze a Python script and return Magic ETL tile recommendations.

    Runs the LangGraph pipeline (code analysis, pattern matching, recommendations).
    There is no fallback: a failure in the graph is raised, not replaced by a
    different result shape.

    Args:
        script: Python source text to analyse.

    Returns:
        The final graph state, including `operations`, `suggestions`, `notes` and
        `recommendations`.

    Raises:
        ScriptAnalysisError: If the graph raises while analysing the script.
    """
    return run_workflow(script)