-
Notifications
You must be signed in to change notification settings - Fork 0
How To Compile a Graph
Devrajsinh Gohil edited this page Aug 30, 2026
·
1 revision
This guide covers advanced compilation options with agentmesh_adapter.compile().
import agentmesh_adapter
from langgraph.graph import StateGraph
builder = StateGraph(MyState)
# ... configure nodes and edges ...
app = agentmesh_adapter.compile(builder)Attach a checkpointer to enable session resumption, time-travel, and state inspection:
from langgraph.checkpoint.memory import MemorySaver
import agentmesh_adapter
memory = MemorySaver()
app = agentmesh_adapter.compile(builder, checkpointer=memory)
# Invoke with thread configuration
config = {"configurable": {"thread_id": "session-101"}}
result = app.invoke({"messages": ["Start session"]}, config=config)
# Retrieve saved state
saved_state = app.get_state(config)
print("Saved state:", saved_state)When agentmesh_adapter.compile(builder) is called:
-
Schema Introspection: Scans
builder.state_schemaandbuilder.channelsfortyping.Annotatedchannel reducers. -
Node Registration: Registers Python callables, unwrapping LangGraph
Runnablewrappers. -
Static Edge Resolution: Maps
__start__, standard directed edges, and__end__sinks into the C++FastNodetable. - Conditional Edge Binding: Binds router functions to source nodes for dynamic branch evaluation.
-
Engine Instantiation: Returns an
AgentMeshCompiledAppwrapper around the nativeagentmesh_core.PyWorkflowEngine.\n
Getting Started
How-To Guides
- Compile a Graph
- Annotated Reducers
- Parallel Fanout
- Send() Map-Reduce
- Command() Routing
- Nested Subgraphs
- Async & Streaming
- Checkpointing & State
- Financial Swarm Example
Architecture
- System Overview
- C++ Engine Internals
- O(1) Scheduler
- Dual-Tier Graph
- Persistence & WAL
- Zero-Copy Pybind Bridge
- SOLID Design Principles
API Reference
Benchmarks
Contributing