orka.nodes.failover_node module

class orka.nodes.failover_node.FailoverNode(node_id, children=None, queue=None, prompt=None, **kwargs)[source]

Bases: BaseNode

A node that implements failover logic by trying multiple child nodes in sequence. If one child fails, it tries the next one until one succeeds or all fail.

__init__(node_id, children=None, queue=None, prompt=None, **kwargs)[source]

Initialize the failover node.

Parameters:
  • node_id (str) – Unique identifier for the node.

  • children (list) – List of child nodes to try in sequence.

  • queue (list) – Queue of agents or nodes to be processed.

  • prompt (str) – Prompt for the node (optional for failover).

  • **kwargs – Additional parameters.

async run(input_data)[source]

Run the failover logic by trying each child node in sequence.

Parameters:

input_data – Input data to pass to child nodes.

Returns:

Result from the first successful child node.

Return type:

dict

Raises:

RuntimeError – If all child nodes fail.