haive.core.graph.node.validation_router_v2

Validation Router V2 - Conditional edge function for routing after V2 validation.

This router function works with ValidationNodeV2 to make routing decisions based on the ToolMessages that were added to state by the validation node.

Flow: 1. ValidationNodeV2 processes tool calls and adds ToolMessages to state 2. This router reads the updated state and makes routing decisions 3. Routes to appropriate nodes (tool_node, parse_output, agent_node, END)

Functions

has_tool_error_v2(message)

Check if a ToolMessage contains an error - V2 version.

validation_router_v2(state)

V2 Validation Router - Routes based on ToolMessages added by ValidationNodeV2.

Module Contents

haive.core.graph.node.validation_router_v2.has_tool_error_v2(message)

Check if a ToolMessage contains an error - V2 version.

Parameters:

message (langchain_core.messages.ToolMessage)

Return type:

bool

haive.core.graph.node.validation_router_v2.validation_router_v2(state)

V2 Validation Router - Routes based on ToolMessages added by ValidationNodeV2.

This function analyzes the ToolMessages that were just added to state and determines where to route next.

Returns:

For regular tools that need execution - “parse_output”: For successfully validated Pydantic models - “agent_node”: For errors that need agent handling - END: When no more processing needed

Return type:

  • “tool_node”

Parameters:

state (dict[str, Any])