Migration guide

From LangGraph to Agentmatic in 5 minutes.

One import change. Your StateGraph, your checkpointer, your tools — they keep working. You ship to production on a Rust engine that's 10× faster.

TL;DR: Run pip install agentmatic. Change from langgraph.graph to from agentmatic. That's the migration. Everything else — conditional edges, checkpointers, time travel, HITL — is identical.

Step 1 — Install

pip install agentmatic

Step 2 — Change one import

# Before
from langgraph.graph import StateGraph, START, END
from langgraph.checkpoint.memory import MemorySaver

# After
from agentmatic import StateGraph, START, END
from agentmatic.checkpoint import MemorySaver

Every other line in your file stays the same. Re-run your existing tests; they should pass.

Step 3 — Bridge LangChain tools (if you use them)

from agentmatic.integrations.langchain import from_langchain_tools
from langchain_community.tools import WikipediaQueryRun, DuckDuckGoSearchRun

tools = from_langchain_tools([WikipediaQueryRun(), DuckDuckGoSearchRun()])
agent = create_react_agent(llm=llm, tools=tools)

Step 4 — Opt into resilience primitives

This is where you start getting value LangGraph can't give you without their paid platform tier:

agent = (Agent.builder("production")
    .llm(OpenAI("gpt-4o"))
    .tools([search, calculator])
    .checkpoint(S3Checkpointer(bucket="my-agents"))
    .circuit_breaker("api", failure_threshold=5)
    .retry_policy(RetryPolicy.exponential(max_attempts=3))
    .dead_letter_queue("failed")
    .interrupt_before(["dangerous_tool"])
    .build())

Step 5 — Optional: wrap as a LangChain Runnable

If you want to keep LangSmith tracing or use LangServe to deploy:

from agentmatic.integrations.langchain import as_langchain_runnable

runnable = as_langchain_runnable(agent)
# Now usable in LCEL, LangServe, LangSmith tracing — anywhere a Runnable goes.

Common gotchas

Done in 5 minutes.

Read the FAQ below, or jump straight to the GitHub repo for the latest examples.

Migration FAQ

What people ask after they migrate.

The compiled-graph surface is 1:1 — StateGraph, START, END, add_node, add_edge, add_conditional_edges, compile, invoke, stream, astream, TypedDict state, Annotated reducers, interrupt_before/after, time travel, MemorySaver. The bits we don't reimplement are LangGraph Platform features (paid SaaS) — but circuit breakers, retry, DLQs, and distributed execution ship in the box.