Skip to content

Exceptions

Custom exception classes for graph operations in PyAgenity.

This package provides
  • GraphError: Base exception for graph-related errors.
  • NodeError: Exception for node-specific errors.
  • GraphRecursionError: Exception for recursion limit errors in graphs.

Modules:

Name Description
graph_error
node_error
recursion_error
storage_exceptions

Structured exception taxonomy for persistence & runtime layers.

Classes:

Name Description
GraphError

Base exception for graph-related errors.

GraphRecursionError

Exception raised when graph execution exceeds the recursion limit.

NodeError

Exception raised when a node encounters an error.

Attributes

__all__ module-attribute

__all__ = ['GraphError', 'GraphRecursionError', 'NodeError']

Classes

GraphError

Bases: Exception

Base exception for graph-related errors.

This exception is raised when an error related to graph operations occurs.

Example

from pyagenity.exceptions.graph_error import GraphError raise GraphError("Invalid graph structure")

Methods:

Name Description
__init__

Initializes a GraphError with the given message.

Source code in pyagenity/exceptions/graph_error.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class GraphError(Exception):
    """
    Base exception for graph-related errors.

    This exception is raised when an error related to graph operations occurs.

    Example:
        >>> from pyagenity.exceptions.graph_error import GraphError
        >>> raise GraphError("Invalid graph structure")
    """

    def __init__(self, message: str):
        """
        Initializes a GraphError with the given message.

        Args:
            message (str): Description of the error.
        """
        logger.error("GraphError raised: %s", message)
        super().__init__(message)

Functions

__init__
__init__(message)

Initializes a GraphError with the given message.

Parameters:

Name Type Description Default
message
str

Description of the error.

required
Source code in pyagenity/exceptions/graph_error.py
18
19
20
21
22
23
24
25
26
def __init__(self, message: str):
    """
    Initializes a GraphError with the given message.

    Args:
        message (str): Description of the error.
    """
    logger.error("GraphError raised: %s", message)
    super().__init__(message)

GraphRecursionError

Bases: GraphError

Exception raised when graph execution exceeds the recursion limit.

This exception is used to indicate that a graph operation has recursed too deeply.

Example

from pyagenity.exceptions.recursion_error import GraphRecursionError raise GraphRecursionError("Recursion limit exceeded in graph execution")

Methods:

Name Description
__init__

Initializes a GraphRecursionError with the given message.

Source code in pyagenity/exceptions/recursion_error.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class GraphRecursionError(GraphError):
    """
    Exception raised when graph execution exceeds the recursion limit.

    This exception is used to indicate that a graph operation has recursed too deeply.

    Example:
        >>> from pyagenity.exceptions.recursion_error import GraphRecursionError
        >>> raise GraphRecursionError("Recursion limit exceeded in graph execution")
    """

    def __init__(self, message: str):
        """
        Initializes a GraphRecursionError with the given message.

        Args:
            message (str): Description of the recursion error.
        """
        logger.error("GraphRecursionError raised: %s", message)
        super().__init__(message)

Functions

__init__
__init__(message)

Initializes a GraphRecursionError with the given message.

Parameters:

Name Type Description Default
message
str

Description of the recursion error.

required
Source code in pyagenity/exceptions/recursion_error.py
20
21
22
23
24
25
26
27
28
def __init__(self, message: str):
    """
    Initializes a GraphRecursionError with the given message.

    Args:
        message (str): Description of the recursion error.
    """
    logger.error("GraphRecursionError raised: %s", message)
    super().__init__(message)

NodeError

Bases: GraphError

Exception raised when a node encounters an error.

This exception is used for errors specific to nodes within a graph.

Example

from pyagenity.exceptions.node_error import NodeError raise NodeError("Node failed to execute")

Methods:

Name Description
__init__

Initializes a NodeError with the given message.

Source code in pyagenity/exceptions/node_error.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class NodeError(GraphError):
    """
    Exception raised when a node encounters an error.

    This exception is used for errors specific to nodes within a graph.

    Example:
        >>> from pyagenity.exceptions.node_error import NodeError
        >>> raise NodeError("Node failed to execute")
    """

    def __init__(self, message: str):
        """
        Initializes a NodeError with the given message.

        Args:
            message (str): Description of the node error.
        """
        logger.error("NodeError raised: %s", message)
        super().__init__(message)

Functions

__init__
__init__(message)

Initializes a NodeError with the given message.

Parameters:

Name Type Description Default
message
str

Description of the node error.

required
Source code in pyagenity/exceptions/node_error.py
20
21
22
23
24
25
26
27
28
def __init__(self, message: str):
    """
    Initializes a NodeError with the given message.

    Args:
        message (str): Description of the node error.
    """
    logger.error("NodeError raised: %s", message)
    super().__init__(message)

Modules

graph_error

Classes:

Name Description
GraphError

Base exception for graph-related errors.

Attributes:

Name Type Description
logger

Attributes

logger module-attribute
logger = getLogger(__name__)

Classes

GraphError

Bases: Exception

Base exception for graph-related errors.

This exception is raised when an error related to graph operations occurs.

Example

from pyagenity.exceptions.graph_error import GraphError raise GraphError("Invalid graph structure")

Methods:

Name Description
__init__

Initializes a GraphError with the given message.

Source code in pyagenity/exceptions/graph_error.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class GraphError(Exception):
    """
    Base exception for graph-related errors.

    This exception is raised when an error related to graph operations occurs.

    Example:
        >>> from pyagenity.exceptions.graph_error import GraphError
        >>> raise GraphError("Invalid graph structure")
    """

    def __init__(self, message: str):
        """
        Initializes a GraphError with the given message.

        Args:
            message (str): Description of the error.
        """
        logger.error("GraphError raised: %s", message)
        super().__init__(message)
Functions
__init__
__init__(message)

Initializes a GraphError with the given message.

Parameters:

Name Type Description Default
message str

Description of the error.

required
Source code in pyagenity/exceptions/graph_error.py
18
19
20
21
22
23
24
25
26
def __init__(self, message: str):
    """
    Initializes a GraphError with the given message.

    Args:
        message (str): Description of the error.
    """
    logger.error("GraphError raised: %s", message)
    super().__init__(message)

node_error

Classes:

Name Description
NodeError

Exception raised when a node encounters an error.

Attributes:

Name Type Description
logger

Attributes

logger module-attribute
logger = getLogger(__name__)

Classes

NodeError

Bases: GraphError

Exception raised when a node encounters an error.

This exception is used for errors specific to nodes within a graph.

Example

from pyagenity.exceptions.node_error import NodeError raise NodeError("Node failed to execute")

Methods:

Name Description
__init__

Initializes a NodeError with the given message.

Source code in pyagenity/exceptions/node_error.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class NodeError(GraphError):
    """
    Exception raised when a node encounters an error.

    This exception is used for errors specific to nodes within a graph.

    Example:
        >>> from pyagenity.exceptions.node_error import NodeError
        >>> raise NodeError("Node failed to execute")
    """

    def __init__(self, message: str):
        """
        Initializes a NodeError with the given message.

        Args:
            message (str): Description of the node error.
        """
        logger.error("NodeError raised: %s", message)
        super().__init__(message)
Functions
__init__
__init__(message)

Initializes a NodeError with the given message.

Parameters:

Name Type Description Default
message str

Description of the node error.

required
Source code in pyagenity/exceptions/node_error.py
20
21
22
23
24
25
26
27
28
def __init__(self, message: str):
    """
    Initializes a NodeError with the given message.

    Args:
        message (str): Description of the node error.
    """
    logger.error("NodeError raised: %s", message)
    super().__init__(message)

recursion_error

Classes:

Name Description
GraphRecursionError

Exception raised when graph execution exceeds the recursion limit.

Attributes:

Name Type Description
logger

Attributes

logger module-attribute
logger = getLogger(__name__)

Classes

GraphRecursionError

Bases: GraphError

Exception raised when graph execution exceeds the recursion limit.

This exception is used to indicate that a graph operation has recursed too deeply.

Example

from pyagenity.exceptions.recursion_error import GraphRecursionError raise GraphRecursionError("Recursion limit exceeded in graph execution")

Methods:

Name Description
__init__

Initializes a GraphRecursionError with the given message.

Source code in pyagenity/exceptions/recursion_error.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class GraphRecursionError(GraphError):
    """
    Exception raised when graph execution exceeds the recursion limit.

    This exception is used to indicate that a graph operation has recursed too deeply.

    Example:
        >>> from pyagenity.exceptions.recursion_error import GraphRecursionError
        >>> raise GraphRecursionError("Recursion limit exceeded in graph execution")
    """

    def __init__(self, message: str):
        """
        Initializes a GraphRecursionError with the given message.

        Args:
            message (str): Description of the recursion error.
        """
        logger.error("GraphRecursionError raised: %s", message)
        super().__init__(message)
Functions
__init__
__init__(message)

Initializes a GraphRecursionError with the given message.

Parameters:

Name Type Description Default
message str

Description of the recursion error.

required
Source code in pyagenity/exceptions/recursion_error.py
20
21
22
23
24
25
26
27
28
def __init__(self, message: str):
    """
    Initializes a GraphRecursionError with the given message.

    Args:
        message (str): Description of the recursion error.
    """
    logger.error("GraphRecursionError raised: %s", message)
    super().__init__(message)

storage_exceptions

Structured exception taxonomy for persistence & runtime layers.

These exceptions let higher-level orchestration decide retry / fail-fast logic instead of relying on broad except Exception blocks.

Classes:

Name Description
MetricsError

Raised when metrics emission fails (should normally be swallowed/logged).

SchemaVersionError

Raised when schema version detection or migration application fails.

SerializationError

Raised when (de)serialization of state/messages fails deterministically.

StorageError

Base class for non-retryable storage layer errors.

TransientStorageError

Retryable storage error (connection drops, timeouts).

Classes

MetricsError

Bases: Exception

Raised when metrics emission fails (should normally be swallowed/logged).

Source code in pyagenity/exceptions/storage_exceptions.py
26
27
class MetricsError(Exception):
    """Raised when metrics emission fails (should normally be swallowed/logged)."""
SchemaVersionError

Bases: StorageError

Raised when schema version detection or migration application fails.

Source code in pyagenity/exceptions/storage_exceptions.py
22
23
class SchemaVersionError(StorageError):
    """Raised when schema version detection or migration application fails."""
SerializationError

Bases: StorageError

Raised when (de)serialization of state/messages fails deterministically.

Source code in pyagenity/exceptions/storage_exceptions.py
18
19
class SerializationError(StorageError):
    """Raised when (de)serialization of state/messages fails deterministically."""
StorageError

Bases: Exception

Base class for non-retryable storage layer errors.

Source code in pyagenity/exceptions/storage_exceptions.py
10
11
class StorageError(Exception):
    """Base class for non-retryable storage layer errors."""
TransientStorageError

Bases: StorageError

Retryable storage error (connection drops, timeouts).

Source code in pyagenity/exceptions/storage_exceptions.py
14
15
class TransientStorageError(StorageError):
    """Retryable storage error (connection drops, timeouts)."""