Skip to content

OSSS.ai.orchestration.error_policies

OSSS.ai.orchestration.error_policies

Error policies for LangGraph nodes and OSSS execution.

This module provides centralized error handling policies, retry configurations, and circuit breaker decorators for robust LangGraph node execution.

ErrorPolicyType

Bases: Enum

Types of error handling policies.

FallbackStrategy

Bases: Enum

Fallback strategies for failed nodes.

PolicyRetryConfig

Bases: BaseModel

Configuration for retry behavior.

Migrated from dataclass to Pydantic BaseModel for enhanced validation, serialization, and integration with the OSSS Pydantic ecosystem.

CircuitBreakerConfig

Bases: BaseModel

Configuration for circuit breaker behavior.

Migrated from dataclass to Pydantic BaseModel for enhanced validation, serialization, and integration with the OSSS Pydantic ecosystem.

ErrorPolicy

Bases: BaseModel

Comprehensive error handling policy.

Migrated from dataclass to Pydantic BaseModel for enhanced validation, serialization, and integration with the OSSS Pydantic ecosystem.

LangGraphExecutionError

Bases: Exception

Wrapper for LangGraph node execution errors.

CircuitBreaker

Circuit breaker implementation for node resilience.

can_execute()

Check if execution is allowed.

record_success()

Record a successful execution.

record_failure()

Record a failed execution.

ErrorPolicyManager

Centralized manager for error policies.

get_policy(node_name)

Get error policy for a node.

set_policy(node_name, policy)

Set error policy for a node.

get_circuit_breaker(node_name)

Get circuit breaker for a node.

get_error_policy_manager()

Get the global error policy manager.

retry_with_policy(node_name)

Decorator for retry behavior based on error policy.

circuit_breaker_policy(node_name)

Decorator for circuit breaker behavior.

timeout_policy(node_name)

Decorator for timeout handling.

comprehensive_error_policy(node_name)

Comprehensive decorator combining all error policies.

handle_node_fallback(node_name, error, fallback_strategy, context=None)

Handle fallback behavior for failed nodes.

get_error_statistics()

Get error handling statistics.