Skip to content

LangGraph Adapter

LangGraphAdapter

Wraps a LangGraph graph to apply stroma contract validation on each node.

Takes a ContractRegistry for validation. Call .wrap(graph) to replace decorated nodes with validating wrappers.

wrap(graph)

Discover stroma-decorated nodes in graph and replace them with validating wrappers.

stroma_langgraph_node(node_id, contract)

Decorator that attaches stroma contract metadata to a LangGraph node function.

Binds node_id and contract as attributes on the decorated function so LangGraphAdapter can discover and validate it.

extract_state_dict(state)

Convert a framework state object to a plain dict.

Supports dicts, Pydantic models, objects with a .dict() method, and plain objects with __dict__. Raises TypeError if the state cannot be converted.