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.
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
- Annotated reducers — Same syntax.
Annotated[list, operator.add]works identically. - Streaming —
agent.stream(...)andagent.astream(...)both work. We also addedagent.astream_events(...)for v2 LangChain-style events. - Checkpoint formats — Memory and SQLite checkpoints are wire-compatible. Postgres requires a one-line schema migration we ship in
agentmatic.checkpoint.postgres.upgrade(). - LangSmith — Set
LANGCHAIN_TRACING_V2=trueas usual; or useas_langchain_runnable()to keep traces.
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.
from_langchain_tools([...]) wraps any LangChain BaseTool. Conversely, as_langchain_runnable(agent) makes Agentmatic a LangChain Runnable, so you keep LangSmith tracing, LCEL composition, and LangServe deployment if you want them.
No. We use the same OpenAI/Anthropic/Bedrock/Gemini client patterns. If you were calling ChatOpenAI() from LangChain you'll call OpenAI() from agentmatic — same constructors, same .invoke().
File an issue. We've reached parity on the public LangGraph 0.2+ surface and add shims as people report gaps. The Rust core compiles in ~30 seconds; PRs are merged the same day for missing methods.
Yes. You can run Agentmatic graphs alongside LangGraph graphs in the same process. The bridge (as_langchain_runnable) lets you embed Agentmatic agents inside a LangGraph supervisor while you migrate node-by-node.