orka.orchestrator.graph_api module

Graph API Interface

Provides runtime access to the orchestrator’s graph structure and state. This module enables GraphScout to inspect the workflow graph and understand available paths and constraints.

class orka.orchestrator.graph_api.NodeDescriptor(id: str, type: str, prompt_summary: str, capabilities: List[str], contract: Dict[str, Any], cost_model: Dict[str, Any], safety_tags: List[str], metadata: Dict[str, Any])[source]

Bases: object

Describes a node in the workflow graph.

id: str
type: str
prompt_summary: str
capabilities: List[str]
contract: Dict[str, Any]
cost_model: Dict[str, Any]
safety_tags: List[str]
metadata: Dict[str, Any]
class orka.orchestrator.graph_api.EdgeDescriptor(src: str, dst: str, condition: Dict[str, Any] | None = None, weight: float = 1.0, metadata: Dict[str, Any] | None = None)[source]

Bases: object

Describes an edge between nodes.

src: str
dst: str
condition: Dict[str, Any] | None = None
weight: float = 1.0
metadata: Dict[str, Any] | None = None
class orka.orchestrator.graph_api.GraphState(nodes: Dict[str, NodeDescriptor], edges: List[EdgeDescriptor], current_node: str, visited_nodes: Set[str], runtime_state: Dict[str, Any], budgets: Dict[str, Any], constraints: Dict[str, Any])[source]

Bases: object

Complete graph state for path discovery.

nodes: Dict[str, NodeDescriptor]
edges: List[EdgeDescriptor]
current_node: str
visited_nodes: Set[str]
runtime_state: Dict[str, Any]
budgets: Dict[str, Any]
constraints: Dict[str, Any]
class orka.orchestrator.graph_api.GraphAPI[source]

Bases: object

Runtime interface to orchestrator graph structure.

Provides methods to inspect the workflow graph, understand node relationships, and access runtime state for intelligent path selection.

__init__()[source]

Initialize Graph API interface.

async get_graph_state(orchestrator: Any, run_id: str) GraphState[source]

Get complete graph state for path discovery.

Parameters:
  • orchestrator – The orchestrator instance

  • run_id – Current run identifier

Returns:

Complete graph state with nodes, edges, and runtime information