haive.core.graph.state_graph.conversion.langgraph¶

LangGraph conversion utilities for Haive graphs.

from typing import Any, Dict This module provides functions to convert Haive graphs to and from LangGraph objects.

Functions¶

convert_to_langgraph(graph[, state_schema])

Convert a Haive graph to a LangGraph StateGraph.

create_parameter_aware_wrapper(func)

Create a wrapper that adapts to the function's parameter count.

extract_callable(node, node_name)

Extract a callable from a node.

Module Contents¶

haive.core.graph.state_graph.conversion.langgraph.convert_to_langgraph(graph, state_schema=None)¶

Convert a Haive graph to a LangGraph StateGraph.

Parameters:
  • graph (Any) – Haive graph instance (BaseGraph or SchemaGraph)

  • state_schema (type[pydantic.BaseModel] | None) – Optional schema to use for the StateGraph

Returns:

LangGraph StateGraph instance

Return type:

langgraph.graph.StateGraph

haive.core.graph.state_graph.conversion.langgraph.create_parameter_aware_wrapper(func)¶

Create a wrapper that adapts to the function’s parameter count.

Parameters:

func (Any) – Function to wrap

Returns:

Wrapped function that handles parameter count differences

Return type:

Any

haive.core.graph.state_graph.conversion.langgraph.extract_callable(node, node_name)¶

Extract a callable from a node.

Parameters:
  • node (Any) – Node object

  • node_name (str) – Name of the node (for logging)

Returns:

Callable function for the node

Return type:

Any