Recovery Coordination#
Router-based recovery strategies and infrastructure error coordination.
The framework implements intelligent recovery coordination through a centralized router system that automatically determines recovery strategies based on error classification. The system coordinates between retry mechanisms, orchestrator replanning, and graceful termination.
Router Recovery System#
Router Conditional Edge#
- osprey.infrastructure.router_node.router_conditional_edge(state)[source]#
LangGraph conditional edge function for dynamic routing.
This is the main export of this module - a pure conditional edge function that determines which node should execute next based on agent state.
Follows LangGraph native patterns where conditional edge functions take only the state parameter and handle logging internally.
Manual retry handling: - Checks for errors and retry count first - Routes retriable errors back to same capability if retries available - Routes to error node when retries exhausted - Routes critical/replanning errors immediately
- Parameters:
state (AgentState) – Current agent state containing all execution context
- Returns:
Name of next node to execute or “END” to terminate
- Return type:
str
Central recovery coordination implementing the complete recovery strategy.
Recovery Flow:
Manual Retry Handling (checked first): - RETRIABLE errors: retry with backoff if attempts remain - REPLANNING errors: route to orchestrator if planning attempts remain - RECLASSIFICATION errors: route to classifier if reclassification attempts remain - CRITICAL errors: route to error node immediately
Normal Routing Logic: - Check execution state and route to next capability or termination
RouterNode Infrastructure#
- class osprey.infrastructure.router_node.RouterNode[source]#
Bases:
BaseInfrastructureNodeCentral routing decision node for the Osprey Agent Framework.
This node serves as the single decision-making authority that determines what should happen next based on the current agent state. It does no business logic - only routing decisions and metadata management.
The actual routing is handled by the router_conditional_edge function.
Infrastructure node that coordinates routing decisions and state management.
- name: str = 'router'#
- description: str = 'Central routing decision authority'#
- async execute()[source]#
Router node execution - updates routing metadata only.
This node serves as the entry point and routing hub, but does no routing logic itself. The actual routing decision is made by the conditional edge function. This keeps the logic DRY and avoids duplication.
- Returns:
Dictionary of state updates for routing metadata
- Return type:
Dict[str, Any]
- async langgraph_node(**kwargs)#
LangGraph-native node function with manual error handling.
This function is called by LangGraph during execution. Infrastructure nodes now use get_stream_writer() and get_config() directly for pure LangGraph integration.
- Parameters:
state (AgentState) – Current agent state
kwargs – Additional parameters from LangGraph
- Returns:
State updates dictionary
- Return type:
Dict[str, Any]
Orchestrator Replanning#
OrchestrationNode#
Classifier Reclassification#
ClassificationNode#
Error Response Generation#
ErrorNode System#
Infrastructure Error Classification#
Classification Node#
See also
- Classification System
Error classification and severity management
- Exception Reference
Complete exception hierarchy with inheritance structure
- Execution Control
ErrorNode, RouterNode, and complete execution control flow