LangGraph

Wrap LangGraph stateful workflows for use with the Reminix runtime

The LangGraph adapter wraps LangGraph's stateful, graph-based workflows for use with the Reminix runtime.

Installation

pip install reminix[runtime,langgraph]

Available Adapters

from_compiled_graph

Wrap a compiled LangGraph (result of StateGraph.compile()):

from langgraph.graph import StateGraph, START, END
from typing import TypedDict
from reminix.adapters.langgraph import from_compiled_graph
from reminix.runtime import serve

class State(TypedDict):
    input: str
    output: str

def process(state: State) -> dict:
    return {"output": f"Processed: {state['input']}"}

graph = (
    StateGraph(State)
    .add_node("process", process)
    .add_edge(START, "process")
    .add_edge("process", END)
    .compile()
)

agent = from_compiled_graph(graph, name="processor", output_key="output")
serve(agent)

Works with LangChain's create_agent()

Since LangChain's modern create_agent() returns a compiled graph, you can also use from_compiled_graph with it:

from langchain.agents import create_agent
from reminix.adapters.langgraph import from_compiled_graph
from reminix.runtime import serve

# create_agent returns a CompiledGraph
lc_agent = create_agent(
    model="openai:gpt-4o",
    tools=[search_tool, calculator_tool],
)

agent = from_compiled_graph(lc_agent, name="smart-agent")
serve(agent)

Options

ParameterTypeDescription
graphCompiledGraphThe LangGraph compiled graph
namestrName for the Reminix agent
output_keystr | NoneKey to extract from final state (optional)
metadatadictOptional metadata for the agent

Handler Mapping

Reminix HandlerLangGraph Method
@agent.invokegraph.ainvoke()
@agent.invoke_streamgraph.astream()
@agent.chatgraph.ainvoke() with messages
@agent.chat_streamgraph.astream() with messages

On this page